Minesweeper

If you have done anything on Windows, you have likely played Minesweeper. It is a puzzle game that requires tracking down mines that are randomly placed in a 2-dimensional grid. The number in each grid cell describes the number of mines in the 8 adjacent cells. One of the more interesting features of minesweeper is what happens when a cell that has zero adjacent mines next to it. It also uncovers any other adjacent cell with a 0!


Setup

Create a directory assignment6 under assignments in your cs170 directory. All code for the assignment should be stored in this directory.

cd ~/cs170/assignments
mkdir assignment6
cd assignment6

Details

Write a program that uses Tk and allows the user to play a regular game of Minesweeper. Your play field consists of a 2-dimensional grid (You need at least a 10 x 10 grid for this assignment) of squares that are initially empty. As the user clicks on a square, you should reveal whether there was a mine under that location. If there was not a mine, you should reveal how many mines are adjacent to that location.

If the number of mines at the location was 0, you should also recursively uncover all of the adjacent locations. This allows for the group uncover of ALL adjacent locations which have exactly 0 adjacent mines.

If the user clicked on a mine, you should identify the location of all of the mines. You should identify which mine the user clicked on by changing the color of the symbol you are using for a mine. For example, if you are using the 'X' character to represent a mine if the play field, the mine the user clicked on could be colored red.

If the user is able to successfully uncover all of the non-mine locations, you should reveal all of the mine locations as if they had clicked on a mine. However, none of the mines should be identified as the one the user clicked on. You should also display a message informing the user that they won.


Submission

You are required to submit a tar file to http://cseval.roanoke.edu/. On cseval, there is a link for Assignment 6. You can create a tar file by issuing the following commands:

cd ~/cs170/assignments
tar czvf assignment6.tgz assignment6/

Last modified: Fri Feb 28 11:21:40 EST 2014