summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-03-09 19:52:03 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-03-09 19:52:03 +0000
commitaea88084cfb8dd80c435384b7095d5c249097ee2 (patch)
tree15c5aba7ecdc2d04d41d855e50becc7ca175e0e2 /games
parentc00e2a2c7e5230837659cf75ab6fa041e2411750 (diff)
make the worm grow faster on larger terminals. this is more fun than
starting with an enormous pile of worm at the start.
Diffstat (limited to 'games')
-rw-r--r--games/worm/worm.67
-rw-r--r--games/worm/worm.c11
2 files changed, 12 insertions, 6 deletions
diff --git a/games/worm/worm.6 b/games/worm/worm.6
index 30b6bad8426..a821b01108c 100644
--- a/games/worm/worm.6
+++ b/games/worm/worm.6
@@ -1,4 +1,4 @@
-.\" $OpenBSD: worm.6,v 1.13 2014/01/28 14:28:44 jmc Exp $
+.\" $OpenBSD: worm.6,v 1.14 2015/03/09 19:52:02 tedu Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)worm.6 8.1 (Berkeley) 5/31/93
.\"
-.Dd $Mdocdate: January 28 2014 $
+.Dd $Mdocdate: March 9 2015 $
.Dt WORM 6
.Os
.Sh NAME
@@ -52,7 +52,8 @@ several of the corresponding lower case key (9 for HL and 5 for JK, or
until you run into a digit, whichever comes first).
.Pp
On the screen you will see a digit.
-If your worm eats the digit it will grow longer by that number of "o"'s.
+If your worm eats the digit it will grow longer by that number of "o"'s,
+scaled to screen size.
The object of the game is to see how long you can make the worm grow.
.Pp
The game ends when the worm runs into either the sides of the screen
diff --git a/games/worm/worm.c b/games/worm/worm.c
index 1fdb40a6c4a..c55989978d2 100644
--- a/games/worm/worm.c
+++ b/games/worm/worm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worm.c,v 1.27 2014/11/03 22:14:54 deraadt Exp $ */
+/* $OpenBSD: worm.c,v 1.28 2015/03/09 19:52:02 tedu Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -60,6 +60,7 @@ struct body {
struct body *next;
} *head, *tail, goody;
int growing = 0;
+int growthscale = 1;
int running = 0;
int slow = 0;
int score = 0;
@@ -106,6 +107,9 @@ main(int argc, char **argv)
endwin();
errx(1, "screen too small");
}
+ growthscale = COLS * LINES / 2000;
+ if (growthscale == 0)
+ growthscale = 1;
if (argc >= 2) {
start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
&errstr);
@@ -301,9 +305,10 @@ process(int ch)
wmove(tv, y, x);
if (isdigit(ch = winch(tv)))
{
- growing += ch-'0';
+ int amt = ch - '0';
+ growing += amt * growthscale;
prize();
- score += growing;
+ score += amt;
running = 0;
wmove(stw, 0, COLS - 12);
wprintw(stw, "Score: %3d", score);