Duration: 3M 23S Likes: 13 DisLikes: 0 Rating: 10 / 10
Views: 1851 Description: This is a version of the classic game Columns.
Most people I show the game to go 'Tetris', so I have to correct them.
It's similar in that pieces are falling from the top of the screen to the bottom but in Columns all the pieces are the same shape, made up of 3 blocks in vertical columns.
You can move the columns left and right as well as rotate the pieces so the top piece goes to the middle, the middle to the bottom and the bottom to the top.
The goal is to create 3 in a row either horizontally, vertically or diagonally. Then these pieces are removed an the pieces above move down (kind of like Tetris)
The goal is to last as long as you can.
This version is on an Arduino using the TVOut Library (http://code.google.com/p/arduino-tvout/) to provide a composite output to a small LCD Screen (it's a Nextbase SDV7, from a in car DVD Player)
Other than the Library all the code is my own. It is a bit hacked together, so not pretty but it works.
In the game there are 5 levels for the speed and an option to have the Preview On or Off.
It's been fun putting the code together and doing the little bit of electronics to get it working.
I ran into the problem of limited memory for data as the Arduino has 32k of program RAM, but only 2k of SRAM for data.
The display alone takes 1,440 bytes, so, not a huge amount left over.
I used integers originally for all the number data, but I had to convert some to BYTE to save RAM. With this and a bit of rejigging of the code I got it to fit.
As per all my Arduino coding I know it's not optimised or using best practice so I expect once I put the code up (soon) smarter and better people than me will find it to be very dirty code.
UPDATE: 6 May 2012:
Link to the Code is on my Blog: