Skip to content

Terminal implementation of the famous Minesweeper game.

Notifications You must be signed in to change notification settings

Lokesh-Bisht/Minesweeper

Repository files navigation

Welcome to Minesweeper 🎮 👋

There aren't many Gen-Y people who hadn't played the Minesweeper game. This project is the terminal implementation of the famous minesweeper game. For now, you can play this game on a 9 * 9 grid. But the grid size can be easily be updated to a bigger grid-like 16 * 16.

Getting started

Terminologies:

Keyword Meaning
Unmarked cells Cells that haven't been explored yet.
Marked cells Explored cells
Safe cell Cell that is empty / doesn't contain a mine.
Clue Explored free cells with 1 to 8 mines around them. Shown to help the user.

Symbols:
.   -->   unmarked cell
/   -->   safe cell
*   -->   may be a mine (marked cell)
X   -->   mine
1   -->   clue


How to play?

  1. Enter the number of mines to begin the game.
  2. Once the game gets started, it will finish only if:
    • You step on a mine. Game Over! 👎😑
    • You found all the mines or explored all the safe cells. You win! 😁✌️
    • Safe cells: Cells that don't contain a mine.
  3. At each step in the game. The game asks you to either mark/unmark a cell as mine (you think a mine can be present here.) or;
  4. Claim a cell as free.
  5. If a cell that you claimed as free contains a mine. Then the game is over!
  6. Otherwise, the game will continue until you find all the mines in the grid or explore all the safe cells.

✨Demo

Minesweeper demo gif.

Installation

From IDE:

  1. Download the project.
  2. Unzip it.
  3. Open the project in an IDE like IntelliJ IDEA, Microsoft Visual Studio or Eclipse.
  4. Build the project.
  5. Run the main file.

From terminal:

  1. Open the project directory on terminal/command prompt.
  2. Use the javac Main.java command to compile the project.
  3. Use the java Main command to run the game.

Note: You need to have Java on your system to run this game.