The science of Tetris

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Wed Dec 1 08:45:40 UTC 1999


on 99-12-01 09.09, Dan Ingalls at Dan.Ingalls at disney.com wrote:

> It looks like it might be hard to delete just the bottom row if each block is
> a morph.  I would handle this by having the game board extend below the bottom
> line and delete blocks as they pass completely below the bottom line.
> 
> One could stick with the current model (a morph per square) and still greatly
> improve efficiency by representing the current block as a collection of
> 1-square morphs.  Then for moveLeft or moveDown, you just tell each component
> square to move left or down, and morphic will take care of repainting just the
> cells that change as a result.

I would suggest composing each 4-square tile as a morph (itself 'invisible')
of 4 square submorphs. When reaching the bottom, you transfer these 4 from
the tile to become submorphs of the stack on the bottom instead, and get rid
of the tile morph.

Then you'd represent the game board Model as a bitmap with 1 bit per square,
and use BitBlt to delete rows from the Model pile when they are filled, and
for collision detection too. OK, this suggestion was maybe only 50% serious,
but it's an intriguing concept and probably a very good way to go if you
know BitBlt well enough.

I hope y'all know that there have been scientific studies of Tetris (and the
one I know of is *very* interesting. I've made reference to it myself). I'd
recommend this one for the interested:

http://cogsci.ucsd.edu/~maglio/some.ps

Henrik

< = > .





More information about the Squeak-dev mailing list