Skip to content

A 2-D grid based game, partially using the rules and concepts of the famous game "Minesweeper".

Notifications You must be signed in to change notification settings

kiruba-r11/Mine-Eluder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Mine-Eluder

A 2-D grid based game, partially using the rules and concepts of the famous game "Minesweeper".

Intro about the Game

Mine Eluder is a 2-D grid based game with some cells having obstacles. Initially all the cells are covered. The goal of the game is to uncover all the possible cells that do not have obstacles. The player can step into any location inside the grid and uncover it. The obstacles are called as mines, where the player should not step into, if he steps into the mine and uncovers it, then the game ends there. There are three difficulty levels in this game, Newbie, Specialist and Master. The dimension of grid and probability of mines is determined according to the difficulty level.

Rules of the Game

  1. The rule of the game is to uncover all the cells that do not have mines in it.

  2. To uncover any cell you may enter the cell location. If the cell you entered has mine it in, then you lose the game, else the game continues.

  3. You can choose the difficulty of the game. There are three difficulty options available. They are

    • NEWBIE
    • SPECIALIST
    • MASTER
  4. Symbols used and its meaning

    • It represents * -> Mine
    • It represents - -> Closed Location
    • It represents O -> Uncovered Location

Configuration of the Grid

1. Dimension of the Grid

NEWBIE 5*5 (Total 25 cells)
SPECIALIST 7*7 (Total 49 cells)
MASTER 9*9 (Total 81 cells)

2. Probability of Mines

NEWBIE 0.20 (Total 5 mines in 25 cells)
SPECIALIST 0.30 (Total 15 mines in 49 cells)
MASTER 0.40 (Total 33 mines in 81 cells)

Concepts Used

  • vector -> C++ STL
  • string -> C++
  • random function
  • class and object

Approach Used

The grid is implemented as a Sparse Matrix where mines are the non-zero elements and other cells are the zero elements. This Sparse Matrix is represented in memory using 2-D vector based on coordinate list method where row and column of mines location is stored. This thereby saves ^((1 - 2 * p) * 100)% of memory. The locations of non-zero elements in the Sparse Matrix is filled using the random function present in the Standard Library.

^ (p - probability of mines) -> the result is approximate value

Spoiler 😉

It is a luck-based game. So, if you are not able to win it, don't worry! There is a CHEAT CODE option where you can enter the cheat and reveal the location of mines before the start of the game.

Pull Requests

I am open to PRs and would really appreciate you to contribute to this repository.

Note: I developed this game as an app which is an upgradation to this command-line application with a good UI. You can find the App code here 👉 Click Here

About

A 2-D grid based game, partially using the rules and concepts of the famous game "Minesweeper".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages