Tetris Piece Rotation Algorithm
Posted
by coppercoder
on Stack Overflow
See other posts from Stack Overflow
or by coppercoder
Published on 2008-10-24T14:49:54Z
Indexed on
2010/05/02
12:07 UTC
Read the original article
Hit count: 808
What are the best algorithms (and explanations) for representing and rotating the pieces of a tetris game? I always find the piece rotation and representation schemes confusing.
Most tetris games seem to use a naive "remake the array of blocks" at each rotation:
http://www.codeplex.com/Project/ProjectDirectory.aspx?ProjectSearchText=tetris
However, some use pre-built encoded numbers and bit shifting to represent each piece:
http://www.codeplex.com/wintris
Is there a method to do this using mathematics (not sure that would work on a cell based board)?
© Stack Overflow or respective owner