Minesweeper
Instructor Notes
Java Version
All Java files were developed and tested using Java version 1.4.2_01
Option #1 - Static Methods and Array Processing
Additional methods could easily be added to Option #1 as additional static methods. The methods to open and mark tiles or the methods to update the game status could be introduced at this point.
Files
Option #2 - OOP
Option #2 is divided into two levels. Level #1 focuses on
creating the Mines and Tiles arrays, marking tiles, and creating a text
representation for the game board. Level #2 adds the complexity of
updating the game status and changing the text representation when the game is
win or lost. Instructors may want to limit students to Level 1.
Level 2 Notes
markTile
method changes
The status of the minesweeper game must be updated each time a tile is opened
with the markTile method. The markTile method must also only allow tiles to be
changed while the game status is play.
getBoard
method changes
The getBoard method must be modified to respond to the status of the game. When
the game status is lose the character for a mine that triggers a loss must be
returned as !. The character for all remaining mines hidden or marked must be
returned as *. Tiles that were incorrectly marked as mines must be returned
as -. When the game status is win the character for all mines hidden or
marked must be returned as F.
gameWon method
The gameWon method returns true when the
game is won. The game is won when all tiles that do not hide mines are
uncovered.
Files
GUI test program
After testing each of your methods using text output, you can test your minesweeper class using
a GUI test program. The .class and image files for a GUI test program are
provided.
Step 1 - Copy each of the following supporting GUI class and image files into the same directory as your minesweeper.class file
Step 2 - Run the GUI test program using your minesweeper.class
java minesweeperGUI
Option #3 - GUI
Students may use the following image files or may be encouraged to create their own images.
flag.jpg | |
mine.jpg | |
minered.jpg | |
minex.jpg |
Minesweeper Demo
A minesweeper demo program is provided as an executable .jar file. (minesweeperDemo.jar)
Step 1 - Copy the following jar file
Step 2 - Run the GUI demo
If you are using a GUI environment you may be able to double-click on the file minesweeperDemo.jar
If this does not work, type the following from the command line
java -jar minesweeperDemo.jar