Due on or before November 15 at 11:59 pm.
For this assignment you will be building a "gopher hunt" game. In gopher hunt, the player has to pick cells on a two dimensional grid, avoiding the locations of the gophers. Each time a cell is selected the number of gophers in the neighboring spaces is revealed in that cell (neighbors includes diagonals so each cell has 8 neighbors). The player loses if they pick a cell containing a gopher. (Yes, this game is very similar to minesweeper.)
On each turn the entire map should be printed, showing which cells have been explored,
which cells haven't been explored, and for the explored cells how many neighboring cells
contain gophers. It should look something like:
|+++10|
|+++20|
|++++1|
|+++++|
|+++++|
(but bigger), where a + is an unexplored cell and the numbers are explored cells showing
the number of neighboring gophers.
Your map should be at least 10x10 size, not counting any borders that are drawn.
Your game should contain at least 10 gophers, placed at random positions within the map.
After the map is displayed the player picks a cell by entering the cell's x,y coordinates as two integers. The program should make sure that these values are in bounds and print an error message and request new coordinates if the requested cell is out of bounds.
If there is a gopher in the selected cell, the player should lose. Otherwise the number of gophers in neighboring cells should be added to the map surrounding the cell that was chosen and the process repeats. The player wins if every cell without a gopher in it has been revealed. A good way to do this is to have the program keep track of the number of cells (e.g. on a 10x10 grid there are 100 cells), the number of gophers (e.g. begin by randomly placing 10 gophers), and the number of player moves (e.g. in this example if the player made 90 moves without getting a gopher then they win).
For this game you will probably want to use two 2-dimensional arrays. One array keeps track of where the gophers are and the number of neighboring gophers for each square. The other array keeps track of which cells the player has already guessed.
You may change the theme of the game. If you want the player to be avoiding zombies or sleeping vampires instead of gophers, that is fine.
If a player selects a cell with zero neighboring gophers, then it is clearly safe to uncover all of the neighboring cells. Your code should automatically uncover all of the neighboring cells if the player selects a cell with a zero neighboring gophers. If any of the automatically uncovered cells contains zero neighboring gophers, the neighbors of those cells should also be uncovered - and so forth.
Turn in: A copy of the program code and sample, annotated output showing the program runs. You do not need to print the output for an entire game, but you should show (and label) the important cases such as: the player winning, the player losing, the player entering an illegal move, and how the map changes when the player enters a legal move. These items should be submitted via Canvas.