A simple game app using TextViews, EditTexts, Buttons and Intents. This app is an upgradation to the command-line game "Mine-Eluder" which I developed using C++.
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
.
-
The rule of the game is to uncover all the cells that do not have
mines
in it. -
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.
-
You can choose the difficulty of the game. There are three difficulty options available. They are
NEWBIE
SPECIALIST
MASTER
NEWBIE | 5*5 | (Total 25 cells) |
SPECIALIST | 7*7 | (Total 49 cells) |
MASTER | 9*9 | (Total 81 cells) |
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) |
Your score is calculated as: (c * 100) / (d - ceil(d * p))
- Here,
c
- cells unlocked which doesn't have minesd
- total cellsp
- probability of mines
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 ArrayList
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 Kotlin Random Class
.
^ (p - probability of mines)
-> the result
is approximate
value
Note: I developed this game using C++ which is a command-line application and this app is an upgradation to it with a good UI. You can find the C++ code here 👉 Click Here