CSc 305 Project 1
Minesweeper
Enhance the GUIskeleton.java from
lab #1 to play a version of
Minesweeper.

The goal of Minesweeper is to find all the hidden bombs in a two
dimensional grid. At the start of the game the grid is completely
filled with hidden squares. Click on a square to reveal the
contents. If you click on a square containing a bomb, you
lose. The goal is to uncover all the squares that don't contain a
bomb as fast as possible.
When you click on a square which doesn't have a bomb, numbers in
squares next to
unrevealed squares will indicate how many bombs are adjacent to it. For
example, if an empty square has a 2 in it, there are 2 bombs adjacent
to it.
When you click on an empty square that has no bombs next to it, all
the adjacent empty squares are revealed.
A right mouse button click will toggle a "flag" image on and
off to allow the player to mark squares that are suspected bombs.
The status panel displays the number of moves
made, score, and time elapsed in minutes and seconds. (You may label
them whatever you like, and
change
the order if you prefer). Score is actually the number of
bombs minus the number of flagged squares. At the beginning of a game
it is just the number of bombs. The number will update as you mark and
unmark squares.
There are 5000 possible boards. The game begins with a randomly
selected board. The board is 10x10 and has 13 bombs.
The Restart button begins the same game over again.
New Game starts a different game (the next sequential game number).
Select Game lets you select a game by number.
Scores opens a dialog showing all the saved winning times.

A hidden "About" button (Alt-A) shows the software version number and
the current game number.

A hidden "Cheat" button (Alt-C) reveals the entire game board (but doesn't
win the game).
Note these must be buttons. Do not use a keylistener.
Use a button mnemonic.
A hidden "Easy" button (Alt-E) creates a board with only one
bomb in the upper left corner.
If the player wins the game a popup dialog should allow the player to
save
their time.

If the player loses, the squares are all revealed.

Note that the bomb that was clicked on is shown as exploded.
When you click an empty cell, it recursively reveals all
the other adjacent empty cells, until it gets to one that
is numbered. For
example, the screenshot below shows a board after only one move -
clicking
on the upper right corner (an "empty" cell).

Note that a click on a cell that contains a number does NOT perform
this recursive reveal action.
Resources
Minesweeper piece images: MinesImages.zip You
may create your own images if you
prefer.
Minesweeper background: Minesbkgd.jpg
Tutorial on Working with Icons
Feature sets
A - Implement all the features described above.
B - No background image. No elapsed time display. No scores
button. Winning the game just displays a "you won" message
but no dialog. About and Cheat buttons are "hidden" (or very small).
C - Basic game play. About and Cheat buttons don't have to be hidden.
Doesn't do recursive reveal. Only one square is revealed for
each click. No flags.
No graphics. Just text in the cells, for example:
covered square
|
.
|
count
|
1- 8
|
bomb
|
X
|
exploded bomb
|
*
|
Testing
Here is the Test Plan.
Alternate Problems
If you aren't fond of minesweeper you may propose an alternate
two-dimensional board game to the instructor. Create a
requirements document for your proposed game like the one above and
submit by email to the instructor by 5pm Fri jan 7.
Assignment Submission - Due Thu Jan 14 11:59pm
- Make sure your source code compiles with no errors and passes CheckStyle.
(You're allowed 5 violations per 1000 lines of code.)
- Use handin to submit your source code electronically (see below).
- Print your source code using 10 point monospaced font. You
might have multiple classes; place the classes in alphabetical
order. Write your name at the top. After your name, write which
feature set you implemented: A, B, or C.
- Submit your work to the table in front of the classroom at the
next class meeting after the due date.
Handing in Your Source Code
Electronically
- Create
a zip file
named Minesweeper.zip
containing the source files for all your
Java
classes and any subdirectories (e.g., for images).
- Do not include your compiled .class files.
- Login
to vogon.csc.calpoly.edu using the Secure Shell Client program
(or your favorite equivalent).
- Upload the zip file your created.
- On vogon, use
the following handin
command
handin
graderjd Project1 Minesweeper.zip
Handing in an executable JAR file
If you are not fluent with creating an executable JAR file,
read the following five sections from the tutorial
Lesson: Packaging Programs in JAR Files.
It will take about 15 minutes.
-
Creating a JAR File
-
Running JAR files as Applications
-
Understanding the Default Manifest
-
Modifying a Manifest File
-
Setting an Application's Entry Point
-
Then create an executable JAR file named
Mines.jar
that
does not contain any source code.
- Be sure your application launches properly with this command:
java -jar Mines.jar
.
-
Follow the same steps as above to submit your JAR file using the handin
command.
2-d Mahjongg solitaire
MahJongg is a computer solitaire game based on a classic
board game which uses ceramic tiles as playing pieces. At the
start of the game the tiles are randomly placed on the board. The
object is to remove all the tiles from the board, given certain
restrictions on the order in which tiles can be removed.
There are three suits of tiles: Bamboo, Dots, Characters.
There are four tiles of each rank from 1 to 7.
Tiles are removed from the board in pairs. A pair
consists of an exact match, i.e. two tiles that are exactly
alike. This means that you must match a tile to another that is
exactly the same. For example a Bamboo 1 matches another Bamboo
1 but does not match a Bamboo 3 or a Dot 1.
Tiles are always removed in pairs and can only be removed from
the left or the right edges of the board. Any tile that is not
on a left or right edge is considered blocked and cannot be
removed.
Use the computer mouse to click on a tile. If it is removable, it
will be marked with a pink border (or other visual indicator).
Click on the matching tile and
both will be removed from the board.
The status panel displays the number of tiles remaining on the board,
and time elapsed in minutes and seconds.
The game is won by clearing all the tiles from the board.
If the player wins the game a popup dialog should allow the player to
save their time.
The game is lost if there are still tiles on the board but no legal
moves are available.
Hint Button. Clicking the hint button will provide a visual indication
of a pair of tiles that are removable.
Mahjongg tile images: mahjonggtiles.zip
Submit Mahjongg.zip and Mahjongg.jar as in the directions
above.
Document History
1/9/2010 Revised Mahjongg board image to have 12 columns x 8 rows. Finished
directions for submitting executable JAR. Fixed broken link to images.