Tuesday, October 11, 2011

Stage 1: planning

Before I write any bad code, I plan to at least jot down some thoughts on the flow of the program, and the algorithm for how the game is played.

Assumptions:

There could be 1 or 2 players.

One or both may be a human, and the other may be a computer.

There could be a single player mode played against a clock or just for kicks.

The number of cards might be 24, or 52, or 32, or some multiple of 2.

We'll account for a max of 52 cards.

KISS:

1 player, forever alone.  24 cards.

The flow:

Player is presented with all the cards, face down.  Player can then turn over and see 2 cards.  If they match, they stay face up, otherwise they go back to face down.  The player is supposed to remember their position and what was on them, hence the title of the game.

The game is over when the player has turned all the cards face up.

The algorithm:

Create the deck.
We assumed 24 cards, so 12 different cards, in pairs.
Randomly spread these cards around the board.
Start the clock on the first click from the user.
Follow the flow outlined above.


Now that we've gotten the super duper hard stuff out of the way.  Let's mess up some code.  I'll be programming this in python, because I'm drunk.  Much like some of my Hispanic friends who revert to spanish when heavily intoxicated, I revert to python, or perhaps C, but no one wants to read C code.

No comments:

Post a Comment