PROBLEM
The following is a description of a game. Your task in this assignment is to design
and write a Java program to allow a user to play the game on a computer.
Description
Minesweeper is a board game, played on a computer by one player, the computer
awarding a score based on the time taken to complete the game. No score is
awarded if the player loses.
The game is played on a board with a grid of covered squares, 15% of which contain
a mine. The player has to discover and disable the mines without getting blown up!
When a player starts a new game, the appropriate number of squares is displayed on
the board, covered so the player cannot see which ones hold a mine. The mines are
randomly distributed on the game board.
The player clicks on a square that is covered. What happens depends on a number
of factors:
If the player left clicks on a square that contains a mine, the mine explodes and
the player has lost.
If the player right clicks on a square that contains a mine, the mine is protected.
Left clicks on this square are ignored thereafter. Once all the mines have been
protected, the game is over and the player has won.
If the player left clicks on a covered square that does not contain a mine, the
square is uncovered and does not respond to further clicks. The square displays
a number indicating how many mines are in adjacent squares, uncovering all the
neighbours of any squares that have no surrounding mines. If the player
uncovers all the empty squares, the player has won.
If the player right clicks on a square that does not contain a mine, the whole
minefield explodes and the player has lost!
Scoring
A player who completes the game successfully is given a score based on the time
taken – the faster the time, the higher the score. Your game should allow any player
to view the top 5 scores.