Better tetris collision detection

As I said in the TODO part of the Making Tetris post, a better way to do collision detection is to have the blocks on the field be bits. This is typically what I saw in academic assignments and student presentations. This is probably the right way to do it in other words. It’s more efficient and it’s more simple (KISS).
Even though this isn’t how I did it in the game, I still wanted to play around with the concept so I made a little prototype that demonstrates the basic gist. Instead of a piece, it’s a single block. Instead of a tetris grid of finished blocks, it’s random blocks. It’s really the same thing, it just looks and plays with different shapes.
So here it is. Space randomizes the grid and the arrow keys move. Play It!
[...] In an old post I talked about doing collision detection using a 2d bitmap (or grid). That example was done using Processing (Java). It was a simple example but was very relevant to all the problems I had when building Tatris which did not use a bitmap for player position, instead it used real 2d space of x,y. [...]