It’s my birthday today! Woohoo!
Being a nerd like i am, i thought to celebrate, i would set myself a coding challenge. The challenge was to make Tetris. And i did. And i thought i would share it here.
It’s not a ‘complete’ game, there are still a few things not handled. But the game plays and works, and i am satisfied.
I give you the source code so you can finish it off in your own way if you find yourself bored.
[i am actually going to fully comment the code next, i just thought i’d post the code ‘as is’ when satisfied first]
Controls are cursors to move and ‘,’ and ‘.’ to rotate.
There’s loads of stuff you could do to it. Make a nicer interface. Add scoring (not just line counting). Make the speed get higher after a certain number of lines have been cleared. Add a ‘Redefine controls’ option. A high-score table. 2 player mode. Do what you like with it.