https://github.com/stanleyy7/minesweeper
A simplified CLI minesweeper game made using Java.
https://github.com/stanleyy7/minesweeper
command-pattern java junit oop
Last synced: 2 months ago
JSON representation
A simplified CLI minesweeper game made using Java.
- Host: GitHub
- URL: https://github.com/stanleyy7/minesweeper
- Owner: StanleyY7
- License: mit
- Created: 2023-02-22T10:51:08.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T01:16:31.000Z (almost 2 years ago)
- Last Synced: 2025-01-11T22:49:30.264Z (4 months ago)
- Topics: command-pattern, java, junit, oop
- Language: Java
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Project: Minesweeper
(I have also refactored this (procedurally) into Go link is: https://github.com/StanleyY7/golangPractice/tree/main/basics/minesweeper I am also working on an OOP refactor into Go)

A simplified CLI minesweeper game made using Java.
## Outline
The main aim of this project was to utilise Java to build a simplified minesweeper CLI game.## MVP
The main requirements of this project were:- To recreate a simplified version of the game Minesweeper to be played in the java console.
- To have the game able to randomly generate 10 mines in a 10x10 grid.
- To have the grid be represented by a 2 dimensional array (or array like structure).
- To enable the user will be able to enter a command that represents a coordinate to check a location for a mine. Whereby after every guess the application should "redraw" the 2d grid. Revealing either a number from 0-8 depending on how many mines surround that location (based on the coordinate).
- That if the user selects a mine, the game will respond "boom!" and the game will be lost.
- That if every non-mine square has been revealed, the game is won.
- That the grid re-renders to the console after every user command.
## Bonus
- I added J-Unit Testing
- I refactored my original procedural programming minesweeper code into OOP (refactored version is in "minesweeperOOP" folder) whereby I also implemented the Command Design Pattern.## Summary
I achieved the above requirements by first implementing the methods one by one in order. As an example I created the grid first, I then made methods to render it, place bombs and then added more logic/methods accordingly until all MVP requirements were met. I then added bonus features, such as colors for grid elements (i.e. a bomb is red) as well as a wins/losses tracker which is printed at the initial start of the game.### Gameplay Screenshot

### Tech Stack
- Java