This repository contains the Java code for a console version of the Minesweeper game with customizable board size and mine density.
- Customizable Board Dimensions: Allows the player to set the number of rows and columns.
- Mine Density: Initially set at 25%, but adjustable.
- Cheat Mode: Displays the location of all mines on the board when enabled. Disable by setting
cheatModetofalse.
- Setup: Players are prompted to enter dimensions for the Minesweeper board.
- Game Play: Players choose cells to reveal. Revealing a mine results in defeat, while revealing all non-mine cells results in a win.
- Reveal Cells: Each revealed cell will display either a mine or the number of adjacent mines.
Main.java: Contains themainmethod for initiating the game.MineSweeper.java: Includes the game logic, such as board setup, gameplay loop, and display functions.
Compile the Main.java and MineSweeper.java files and execute the Main class:
javac Main.java MineSweeper.java
java Main
This Minesweeper game is open-sourced software licensed under the MIT license.