On Fri, Jun 10, 2016 at 06:00:48AM +0200, Theo Buehler wrote: > The tetris playing field has an extra row on top of the visible rows. > It is possible and not an error to place a tile in such a way that it > occupies a square of this invisible row (the game ends when the next > tile starts out on an already occupied square). > > The problem with this is that there's a bug in the function eliding > rows: it never clears the extra row. > > This means that once a square in the extra row is occupied, it remains > occupied. In other words, the column becomes unusable for game play. > This is helpful if one of the two columns at the border of the playing > field is concerned (you will be able to can clear future rows quicker) > and deadly otherwise (you soon won't be able to clear rows anymore). > > So let's clear that extra row whenever a row is elided.
I just noticed that christos@netbsd made the exact same change almost exactly a year ago: http://cvsweb.netbsd.org/bsdweb.cgi/src/games/tetris/tetris.c.diff?r1=1.30&r2=1.31&only_with_tag=MAIN Sorry, I should have checked before sending this mail. > > Index: tetris.c > =================================================================== > RCS file: /var/cvs/src/games/tetris/tetris.c,v > retrieving revision 1.30 > diff -u -p -r1.30 tetris.c > --- tetris.c 7 Mar 2016 12:07:57 -0000 1.30 > +++ tetris.c 10 Jun 2016 03:09:10 -0000 > @@ -105,6 +105,7 @@ elide(void) > tsleep(); > while (--base != 0) > board[base + B_COLS] = board[base]; > + memset(&board[1], 0, B_COLS - 2); > scr_update(); > tsleep(); > break; >