петък, 1 август 2008 г.

Simple Puzzle Game

Anyways it's a game of perception. Lets pretend that we have 8 boxes, formed in a square, like so:
1 2 3
[][][]
[]8 []4
[][][]
7 6 5
There are 2 possible states of a box - empty and full. Now lets pretend we have this pattern:

1 2 3
[.][][]
[]8 [.]4
[.][][] . = full
7 6 5

A player is allowed to toggle a box's state and the neighbor boxes' states as well, thus if one toggles box #7 (i.e. it goes full -> empty and vice versa), box #8 and #6 also toggle state, so the outcome will be #8 = full;#7 = empty;#6 = full.
Now, the objective of the game is, that all the boxes go full. Upon starting the game, they'll all be in a random state. Pretty neat, don't you think?
I'm willing to make this game with a 128x64 graphical LCD and a PIC18F452 MCU. So far I have the code to run the LCD, but nothing else. In this snippet, the MCU simply clears the LCD and puts the letter 'A' in the start, nothing more. The pic runs at 8 MHz, on a cheap test PCB (I'll post a pic next time). I have yet to add a PRNG(psuedo random number generator) for the box combinations, code to draw the boxes, code for a simple keypad and for the game itself. Yes, thats pretty much, but step by step, I'll make all of it... It's going to be a fun game, I hope.