[Graham] designed this PIC based Tetris game on a single board. The hardware is quite nice but we enjoyed his explanation of the graphics algorithm that he used. Having coded Tetris from the ground up ourselves we understand how difficult it is to explain how the program works. Tracking pieces already on the board as well as moving pieces, making sure that rotation won’t cause a collision with another piece or go out-of-bounds, and looking for completed lines all add up to one bid headache.
[Graham’s] method for handling rotation involves choosing a point around which to rotate, measuring how this affects each pixel in the piece, and then checking those pixels for overlaps. It may take a couple of readings, but he’s done a brilliant job of making it understandable. There’s a demo after the break and the link at the top takes you to his treatise on Tetris.