Breaking down problems
Snakes and ladders is a classic game played by children all around the world. It is possible to create a version on the computer. Although the game is simple it does require a lot of thought in order to create a working game. Top down design will help us solve this problem.
Board - This is the actual game board which you would play on. It will include things like where the snakes and ladders are. It will also store how many squares there are.
Players - This will control where the players are. It will control names for the players. It will also control moving the players around
Game - Will control things such as the dice and whoose go it is. It will also see if someone has won and report the result.
We then split each section into smaller modules. These may then be split further until they can not be split up any more. Consider the above example
Store board - Will be stroring the board and where the snakes and ladders will be. It should initialise itself to ensure the board is empty
Add snakes - Will add snakes to the board. It will decide on where the snakes will go and how many. It will also ensure that snakes and ladders do not over lap. It will also decide on how long each one is
Add ladders - Will add ladders to the board. It will do the exact same as the add snakes one.