Minesweeper Game Development in JavaFX: Features and Implementation

Verified

Added on  2019/09/18

|3
|1019
|390
Practical Assignment
AI Summary
This assignment involves creating a Minesweeper game using JavaFX. The game requires a functional game board with a score area, timer, and start button. The core gameplay includes handling cell selections, revealing numbers, clearing adjacent cells, and managing game states (win/lose). Players can mark cells as bombs or potential bombs using right-click functionality. The assignment emphasizes proper code organization with separate packages and classes for the view and controller. CSS is used for styling the cells. Bonus features include game modes (small, medium, large boards), difficulty levels (bomb percentages), score reporting with persistent storage, and sound effects for various game events. The solution includes detailed implementation of all the required and bonus features, addressing game logic, user interface, and overall game design.
Document Page
Minesweeper
Everything must be written in JavaFX
Gameboard
1. (15 pts) There should be a score area at the top that displays the time elapsed, number of bombs left,
and a start button. The main area is a grid of cells. You can create just a single mode of 20x20 cells and
100 bombs (That’s 25% of the grid).
2. (5 pts) The game window is not resizeable
Gameplay
Minesweeper is a game of logic. (If you haven’t played Minesweeper, then Google it up and play for a
bit. It’ll be easy to understand.) Players use information about a given cell to determine which cells have
bombs, and which do not. The player must clear all cells that do not have bombs in order to win the
game. The game works as follows:
1. Player selects a cell (left mouse click) from the game board grid.
a. (5 pts) If it is the first cell selected then the timer starts.
b. (15 pts) The timer works properly and doesn’t interfere with gameplay
c. (15 pts) If the cell does not contain a bomb, then it displays the number of neighbors
(including diagonally) that contain a bomb.
d. (15 pts) If no neighboring cells contain a bomb, then each neighboring cell is cleared as if they
had each been selected by the user.
e. (10 pts) If the cell contains a bomb the game is over.
2. (15 pts) A player may right click on a non-cleared cell to mark it.
a. Cycle through the following markings in this order
i. Bomb (mark with flag image)
ii. Possible Bomb (mark with question image)
iii. No marking b. Cells marked as bombs or possible bombs may not be selected (with
left click)
3. (10 pts) Player continues to select cells until all cells are cleared that do not have bombs
4. Game over
a. (15 pts) The timer is stopped when the game is over
b. (20 pts) If player successfully clears board, then all bomb locations are revealed with an image
of a bomb in each cell with a green background.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
c. (15 pts) If the player clicks a bomb, then all bomb locations are revealed with an image of a
bomb in each cell.
i. Successfully marked bomb cells have a green background
ii. Unmarked cells with a bomb have a red background
iii. Marked cells without a bomb have a yellow background iv. All other cells are left unchanged
d. (10 pts) Provide appropriate message when game is over
i. Use timer value in message if game is completed successfully
e. (10 pts) User should be able to click a reset button and play again
i. Everything should reset properly
ii. Unusual behavior in gameplay after the first game will result in lost points.
In addition to meeting all of the gameplay and gameboard requirements, you must adhere to the
following:
1. (10 pts) packages & classes
a. one for view with AT LEAST the following
i. one class for scoreboard
ii. one class for cell (each button is a cell) 1. inherit Button (or some other Node of your
choosing) in this class
b. package for controller
i. at least one class to control gameplay
c. Note: Just do your best at separating code properly. It will force you to think about your code
more, which will streamline things and probably save you a good amount of time.
2. (15 pts) Use CSS to control how the cells (Buttons) look at different stages
Bonus Features
1. (15 pts) Create a mode feature. This will allow a user to select a small, medium, or large board.
Changing this mode will end the current game and the newly sized board will start when the player
clicks the start button. The game window should resize appropriately as well. (Hint: look for a method
called sizeToScene())
a. Small: 10x10
b. Medium: 25 x 25
c. Large: 50 x 25 2. (10 pts)
Document Page
2.Create a difficulty feature. This will allow the user to change the percentage of square that are bombs.
Changing this mode will end the current game and the newly sized board will start when the player
clicks the start button. The game window should resize appropriately as well.
a. Easy: 10%
b. Medium: 25%
c. Hard: 40%
3. (10 pts) Add reporting to your game. The scores should be persistent through each execution of the
game. If a player wins they should be prompted for their name. Then their name and the time it took to
complete should be saved. A menu item selection should display a pop-up of the winning scores.
Another menu item should erase the list.
4. (15 pts) Add sounds to your game. A menu item will allow a user to turn this mode off and on. At a
minimum there should be distinct sounds (different for each case) in the following circumstances:
a. User selects a non-bomb button
b. User selects a bomb-button
c. User toggles button marks (right click buttons)
d. Winning game over music
e. Losing game over music
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]