I have a jumbo terminal. worm(6) is cheese for approximately the first hour of
play because the worm's growth is imperceptible compared to the available
space. In theory, I could increase the start length, but that's kind of
degenerate. worm 1000 leaves you with this giant pile of worm stretching back
and forth across the terminal. Eating a pellet on the bottom of the screen
isn't an exercise in strategy, but it is rather boring to wrap the whole worm
up in one corner to make an opening.

Solution: scale the worm's growth by the terminal size. The break point of
1000 means that growthscale is still 1 for an 80x24 terminal, but 2 for an
80x25 terminal.

Side effect: score doesn't get incremented again for eating a second pellet
while still growing. This seems unintentional; there's little skill involved
so I don't think it should result in a bonus.


Index: worm.c
===================================================================
RCS file: /cvs/src/games/worm/worm.c,v
retrieving revision 1.27
diff -u -p -r1.27 worm.c
--- worm.c      3 Nov 2014 22:14:54 -0000       1.27
+++ worm.c      18 Feb 2015 22:50:07 -0000
@@ -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,8 @@ main(int argc, char **argv)
                endwin();
                errx(1, "screen too small");
        }
+       if (COLS * LINES > 1000)
+               growthscale = COLS * LINES / 1000;
        if (argc >= 2) {
                start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
                    &errstr);
@@ -301,9 +304,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);

Reply via email to