Minesweeper on n*m*2 matrix for Android. The goal of the game is to find all of mines and mark them with a long press. When you double-tap on field without a mine[x, y, z], you will get the number of mines in neighbor fields (if they exist) [(x-1), y, z], [(x+1), y, z], [x, (y-1), z], [x, (y+1), z], [x, y, (z+1) mod 2]. If you double-tap on a field with a mine, the game will end.
There are 5 modes with possible extensions.
- 5x5x2 with 7 mines
- 8x8x2 with 16 mines
- 10x10x2 with 25 mines
- 12x12x2 with 50 mines
- 15x15x2 with 90 mines
More screenshots can be found in this folder.
- Android Studio 2023.1.1
- A device with Android newer than 4.4
Download the repository and open the root folder as a project in Android Studio. Do Grandle sync, and clean and build. After that, you should be able to build it and either run it on your device or VM.
This project is licensed under the GPL-3.0 License - see LICENSE.md file for details
The MainActivity is the menu, which is shown first. The GameActivity contains a view, of where the game is played.
To prevent bugs coming from Android tendencies of endless reinitializations of Activity classes, the game data were moved to the static class LoadedGame. There are no limitations coming from that because only one game can be played at the same time.
There are saved 3 instances of 3 classes: GameStatus, MinesContainer, Activity (the last MainActivity loaded)
You can find here the elemental classes of the program.
- LoadedGame - ...
- MyHappyException - Exception class for throwing exceptions specific to this program
- Utils - Any generally useful code
- MainActivity - An activity class, that defines the modes of the game
- GameStatus - The status of the running game. (things like the time of a start)
- GameActivity - An activity class, which runs a game view
- IDrawable - Interface, which is implemented by all of the game components
- MinesView - The view in GameActivity, in which are initialized, drawn, updated,... all of IDrawable
- Grid - It draws the grid and sends commands to mine fields.
- MineField - It draws one of mines. One instance is always paired with only one mine and with one MineField[x][y][(z+1)mod 1].
- MinesLayoutComputor - Stuff like the margin of the grid, size of the grid,...
- StatusLabel - The text in the left corner.
- SwitchButton - The button, which switches the level(z) of the grid.
It takes care of animations in the program. It is easily understandable from the code.
- MinesGenerator - Interface for problem generator
- RandomMinesGenerator - The actual generator of all problems.
- Mine - the container for storing information about one mine
- MinesContainer - the container for storing Mine