[5.3] Pseudocode Example
This is the pseudocode for a Game of Monopoly, including
one person's move as a procedure:
Main Procedure Monopoly_Game
Hand out each player's initial money.
Decide which player goes first.
Repeat
Call Procedure Monopoly_Move for next player.
Decide if this player must drop out.
Until all players except one have dropped out.
Declare the surviving player to be the winner.
Procedure Monopoly_Move
Begin one's move.
Throw the dice.
Move the number of spaces on the board shown on the dice.
If the token landed on "Go to Jail,"
then go there immediately.
Else if the token landed on "Chance" or "Community Chest,"
then draw a card and follow its instructions.
Else
follow the usual rules for the square (buying property,
paying rent, collecting $200 for passing "Go", etc.).
End one's move.