Homework 05
Due 10/27/2017 11:55pm
Mine Walker
Objective:
Write a game where you are an X trying to get an ice cream
cone in a mine field
- Before the game starts, a field of mines are created.
- The board has to be first initialized
- There mines occupy a tenth of the board (IE (BoardSize x
BoardSize)/10 = the number of mines)
- The mines are randomly placed on the board. If a space
which is already occupied (either by the player, the ice cream cone, or
another mine) is selected then another space must be selected until an
empty space is found.
- The player is placed at 0,0
- The ice cream cone is placed at a random location on the
board
- At each turn, the player chooses to move in the X or Y
direction by entering either -1, 0, or 1, where
- -1 is going one space in the negative direction
- 1 is going one space in the positive direction (remember
positive for Y is down)
- 0 is staying still
- 9 quits the game
- Anything other than these values should prompt the player
that they have inputted an invalid value and then not move in that
direction (IE 0).
- Before each turn the board is displayed indicating where
the player (X) and the goal (^) are located. Unoccupied spaces and mines
are denoted by and underscore (_). Remember mines need to be hidden so
they are also underscores (_). The board is maximum 10 spaces long and
wide.
- Once the player reaches the ice cream cone the player wins
- If the player lands on a space with a mine they are killed
and the game is over
- After the game is over, the player should be prompted
whether or not they want to play again.
Example Dialog:
Welcome to Mine Walker. Get the ice cream cone and avoid the
mines
X_________
__________
__________
__________
__________
__________
__________
__________
__________
_________^
Enter either a -1, 0, or 1 in the X or 9 to quit
1
Enter either a -1,0, or 1 in the Y
1
__________
_X________
__________
__________
__________
__________
__________
__________
__________
_________^
Enter either a -1, 0, or 1 in the X or 9 to quit
0
Enter either a -1,0, or 1 in the Y
1
__________
__________
_X________
__________
__________
__________
__________
__________
__________
_________^
Enter either a -1, 0, or 1 in the X or 9 to quit
-1
Enter either a -1,0, or 1 in the Y
1
Boom! Dead!
Would you like to play again?
Submit the files to the drop box (https://dropbox.cse.sc.edu)