We want a computer solitaire game which lets the player try to solve
the traffic
jam puzzle. The game doesn't assist in solving the
puzzle, it just monitors the game. It should display the
board, accept a player's move, update the board, detect a win,
ignore illegal moves, and allow the player to start over.
1.0 INPUT REQUIREMENTS
The player's move - an integer 1 to 11 (or 0 to
start over).
Any alphabetic key terminates the program.
2.0 OUTPUT REQUIREMENTS
2.1 Display a welcome message.
2.2 Display of the current
board configuration, showing position of people on the rocks.
2.3 Prompt for a move.
2.4 Congratulations message
(when player wins).
3.0 FUNCTIONAL REQUIREMENTS
3.1 Display welcome
message.
3.2 Display the board.
3.3 Display a prompt for
a move.
3.4 Obtain the player's
move (a number indicating the person that should move to the empty
rock).
3.5 Determine if the move
is legal, and ignore illegal moves.
3.6 Update the board to
reflect the player's move.
3.7 Determine if the
puzzle is solved.
3.8 Start the game over.
3.9 Terminate the game.
4.0 USER INTERFACE REQUIREMENTS
4.1 The user interface is to
be a text based, scrolling display of characters. Each "rock"
is designated by a number underneath a horizontal line, and people
are shown as ">" or "<" depending of which direction they are
facing. At the start of the game, the display looks like this:
4.2 The Welcome message
is: "Welcome to Traffic Jam. (Enter a move
or 0 to restart.)"
4.3 The prompt for player move
is: "Your move?"
4.4 The congratulations
message is: "Hurray, you won!"
5.0 ERROR HANDLING
5.1 Input of a character or a
floating point number will cause the program to
terminate.
5.2 Input of an integer less
than zero or greater than 11 will be ignored.
5.3 Input of a move that isn't
allowed by the rules of the game will be ignored.