[comp.sys.handhelds] bug in Tetris 3.0

stevev@greylady.uoregon.edu (Steve VanDevender) (04/01/91)

If you play the new Tetris 3.0, you may notice that as you
increase in levels, the drop rate of pieces actually slows down
instead of speeds up.  I have traced this to a problem in the
routine 'delay', which goes something like this:

\<< b .004 - DUP
  IF 0 \<=
  THEN .004 DUP 'a' STO 'b' STO DROP
  ELSE
    IF DUP .04 MOD 0 ==
    THEN DUP 'a' STO LVL INCR SHLV
    END 'b' STO
  END
\>>

The bug comes from the "LVL INCR", which leaves the incremented
value of LVL on the stack.  SHLV doesn't affect the stack, so the
subsequent 'b' STO puts the value of LVL into b instead of the
decreased value of b.  When you go to level 1, the piece delay
goes up to about 1 second; level 2 delays for 2 seconds, level 3
delays for 3 seconds, and by then the game is unplayable so I
quit.

I tried putting DROP after LVL INCR, but then when I finished a
game I got a "Error: bad argument type" with a flag list in level
1, presumably after the cleanup routine failed somehow.  So I'm
kind of stumped about how to fix the bug myself.

The behavior of the game is also a little odd in that in other
versions of Tetris I've seen increment the level, and therefore
the drop rate, every 10 lines, whereas Andrey's Tetris increments
the level after every 10 pieces.

--
Steve VanDevender 	stevev@greylady.uoregon.edu
"Bipedalism--an unrecognized disease affecting over 99% of the population.
Symptoms include lack of traffic sense, slow rate of travel, and the
classic, easily recognized behavior known as walking."