2022-08-08 15:56:44 +08:00
|
|
|
/*
|
|
|
|
* Minesweeper by Matthew Zegar
|
|
|
|
* https://github.com/mzegar/Minesweeper-Cplusplus
|
|
|
|
* app icon from https://www.flaticon.com/free-icon/mine_486968
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <ctime>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include <raylib.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#define ROWS 9
|
|
|
|
#define COLUMNS 9
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
#define EMPTY 0
|
|
|
|
#define MINE -1
|
2022-08-08 15:56:44 +08:00
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
class Block {
|
2022-08-08 15:56:44 +08:00
|
|
|
public:
|
2022-08-08 16:18:42 +08:00
|
|
|
Block();
|
|
|
|
Block(int x, int y, int btype);
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Mutators
|
2022-08-08 16:18:42 +08:00
|
|
|
void setX(int x);
|
|
|
|
void setY(int y);
|
|
|
|
void setRevealed(bool reveal);
|
|
|
|
void setMarked(bool mark);
|
|
|
|
void setType(int btype);
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// Accessors
|
2022-08-08 16:18:42 +08:00
|
|
|
int getX();
|
|
|
|
int getY();
|
|
|
|
bool isRevealed();
|
|
|
|
bool isMarked();
|
|
|
|
int getType();
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Coordinates of block
|
2022-08-08 16:18:42 +08:00
|
|
|
int mX;
|
|
|
|
int mY;
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// States
|
2022-08-08 16:18:42 +08:00
|
|
|
bool mRevealed;
|
|
|
|
bool mMarked;
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// Type
|
2022-08-08 16:18:42 +08:00
|
|
|
int mType; // Ranges from -1 to 8
|
2022-08-08 15:56:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// Create 2d array
|
2022-08-08 16:18:42 +08:00
|
|
|
Block gameboard[ROWS][COLUMNS];
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Generate random number
|
|
|
|
int randomnum() {
|
|
|
|
return rand() % 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate number blocks
|
2022-08-08 16:18:42 +08:00
|
|
|
void countMinesInNeighbors(int i, int j);
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// Update empty spots
|
2022-08-08 16:18:42 +08:00
|
|
|
void revealBlocks(int x, int y);
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// Game states
|
|
|
|
bool gameover = false;
|
|
|
|
bool gamewon = false;
|
2022-08-08 16:18:42 +08:00
|
|
|
void restartGame();
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
|
|
|
|
// Initialization of window
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
int screenWidth = 450;
|
|
|
|
int screenHeight = 450;
|
|
|
|
InitWindow(screenWidth, screenHeight, "Minesweeper by Matthew Zegar");
|
|
|
|
SetTargetFPS(60);
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
restartGame();
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
// Mouse setup
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
Vector2 mouse;
|
|
|
|
|
|
|
|
// Main game loop
|
|
|
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
|
|
{
|
|
|
|
// Mouse update
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
mouse = GetMousePosition();
|
|
|
|
|
|
|
|
// Draw
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
BeginDrawing();
|
|
|
|
|
|
|
|
// Mouse left click
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) {
|
|
|
|
if (!gameover && !gamewon) {
|
|
|
|
int y = floor(mouse.y/50);
|
|
|
|
int x = floor(mouse.x/50);
|
|
|
|
if (y >= 0 && y < ROWS
|
|
|
|
&& x >=0 && x < COLUMNS ) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[y][x].isMarked() == false) {
|
|
|
|
gameboard[y][x].setRevealed(true);
|
|
|
|
if (gameboard[y][x].getType() == EMPTY) { // CHECK IF 'EMPTY'
|
|
|
|
gameboard[y][x].setRevealed(false);
|
|
|
|
revealBlocks(y, x);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[y][x].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
gameover = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mouse right click
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) {
|
|
|
|
if (!gameover && !gamewon) {
|
|
|
|
int y = floor(mouse.y/50);
|
|
|
|
int x = floor(mouse.x/50);
|
|
|
|
if (y >= 0 && y < ROWS
|
|
|
|
&& x >=0 && x < COLUMNS ) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[y][x].isRevealed() == false) {
|
|
|
|
if (gameboard[y][x].isMarked() == false) {
|
|
|
|
gameboard[y][x].setMarked(true);
|
2022-08-08 15:56:44 +08:00
|
|
|
} else {
|
2022-08-08 16:18:42 +08:00
|
|
|
gameboard[y][x].setMarked(false);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the blocks
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j].isRevealed() == false) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, LIGHTGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
2022-08-08 15:56:44 +08:00
|
|
|
} else {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j].getType() == MINE) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, RED);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
} else if (gameboard[i][j].getType() == EMPTY) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, GRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
} else if (gameboard[i][j].getType() == 1) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, DARKGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
DrawText(TextFormat("%i", gameboard[i][j].getType()), gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+15, 25, SKYBLUE);
|
|
|
|
} else if (gameboard[i][j].getType() == 2) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, DARKGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
DrawText(TextFormat("%i", gameboard[i][j].getType()), gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+15, 25, GREEN);
|
|
|
|
} else if (gameboard[i][j].getType() == 3) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, DARKGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
DrawText(TextFormat("%i", gameboard[i][j].getType()), gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+15, 25, RED);
|
|
|
|
} else if (gameboard[i][j].getType() == 4) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, DARKGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
DrawText(TextFormat("%i", gameboard[i][j].getType()), gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+15, 25, DARKBLUE);
|
|
|
|
} else if (gameboard[i][j].getType() >= 5) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, DARKGRAY);
|
|
|
|
DrawRectangleLines(gameboard[i][j].getY()*50, gameboard[i][j].getX()*50, 50, 50, BLACK);
|
|
|
|
DrawText(TextFormat("%i", gameboard[i][j].getType()), gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+15, 25, MAROON);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the marked blocks (flags)
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j].isMarked() && !gameboard[i][j].isRevealed() ) {
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50+15, gameboard[i][j].getX()*50+10, 10, 10, RED);
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50+25, gameboard[i][j].getX()*50+10, 5, 25, BLACK);
|
|
|
|
DrawRectangle(gameboard[i][j].getY()*50+20, gameboard[i][j].getX()*50+35, 15, 5, BLACK);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update variable to determine if won
|
|
|
|
//----------------------------------------------------------------------------------
|
2022-08-08 16:18:42 +08:00
|
|
|
int totalblocks = 0;
|
2022-08-08 15:56:44 +08:00
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j].getType() >= 1 and gameboard[i][j].isRevealed() == false) {
|
2022-08-08 15:56:44 +08:00
|
|
|
totalblocks++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for win
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
if (totalblocks == 0) {
|
|
|
|
DrawText("Game won!", 103, 203, 50, BLACK);
|
|
|
|
DrawText("Game won!", 100, 200, 50, GREEN);
|
|
|
|
DrawText("right click to restart", 101, 251, 25, WHITE);
|
|
|
|
DrawText("right click to restart", 100, 250, 25, BLACK);
|
|
|
|
gamewon = true;
|
|
|
|
|
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
gameboard[i][j].setRevealed(true);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((IsMouseButtonReleased(MOUSE_RIGHT_BUTTON))) {
|
2022-08-08 16:18:42 +08:00
|
|
|
restartGame();
|
2022-08-08 15:56:44 +08:00
|
|
|
gamewon = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for gameover
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
if (gameover == true) {
|
|
|
|
DrawText("Game Over", 103, 203, 50, BLACK);
|
|
|
|
DrawText("Game Over", 100, 200, 50, RED);
|
|
|
|
DrawText("right click to restart", 101, 251, 25, WHITE);
|
|
|
|
DrawText("right click to restart", 100, 250, 25, BLACK);
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
|
|
|
gameboard[i][j].setRevealed(true);
|
|
|
|
}
|
|
|
|
}
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
if ((IsMouseButtonReleased(MOUSE_RIGHT_BUTTON))) {
|
2022-08-08 16:18:42 +08:00
|
|
|
restartGame();
|
2022-08-08 15:56:44 +08:00
|
|
|
gameover = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EndDrawing();
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
|
|
|
|
// De-Initialization
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
CloseWindow(); // Close window and OpenGL context
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Floodfill algorithm
|
2022-08-08 16:18:42 +08:00
|
|
|
void revealBlocks(int x, int y) {
|
|
|
|
if (x >= 0 && x <ROWS && y >= 0 && y < COLUMNS) {
|
|
|
|
if (gameboard[x][y].getType() != EMPTY) {
|
|
|
|
gameboard[x][y].setRevealed(true);
|
2022-08-08 15:56:44 +08:00
|
|
|
} else {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[x][y].isRevealed() == false) {
|
|
|
|
gameboard[x][y].setRevealed(true);
|
|
|
|
revealBlocks(x-1, y);
|
|
|
|
revealBlocks(x-1, y-1);
|
|
|
|
revealBlocks(x-1, y+1);
|
|
|
|
|
|
|
|
revealBlocks(x, y-1);
|
|
|
|
revealBlocks(x, y+1);
|
|
|
|
|
|
|
|
revealBlocks(x+1, y-1);
|
|
|
|
revealBlocks(x+1, y);
|
|
|
|
revealBlocks(x+1, y+1);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Restart the game
|
2022-08-08 16:18:42 +08:00
|
|
|
void restartGame() {
|
2022-08-08 15:56:44 +08:00
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
gameboard[i][j] = Block(i,j,EMPTY);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate mines
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
srand(time(NULL));
|
|
|
|
for (int i = 0; i < ROWS; ++i) {
|
|
|
|
for (int j = 0; j < COLUMNS; ++j) {
|
|
|
|
if (randomnum() == 1) {
|
2022-08-08 16:18:42 +08:00
|
|
|
gameboard[i][j].setType(MINE);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate numbers
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
for (int i = 0; i < 9; ++i) {
|
|
|
|
for (int j = 0; j < 9; ++j) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j].getType() != MINE) {
|
|
|
|
countMinesInNeighbors(i,j);
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generates the numbered blocks based on mines
|
2022-08-08 16:18:42 +08:00
|
|
|
void countMinesInNeighbors(int i, int j) {
|
2022-08-08 15:56:44 +08:00
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
// Check left hand side
|
|
|
|
if ((j-1)>=0) {
|
|
|
|
if ((i-1) >= 0) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i-1][j-1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j-1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if ((i+1) < ROWS) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i+1][j-1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check middle
|
|
|
|
if ((i-1) >= 0) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i-1][j].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((i+1) < ROWS) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i+1][j].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check right
|
|
|
|
if ((j+1)<COLUMNS) {
|
|
|
|
if ((i-1) >= 0) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i-1][j+1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i][j+1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if ((i+1) <= ROWS) {
|
2022-08-08 16:18:42 +08:00
|
|
|
if (gameboard[i+1][j+1].getType() == MINE) {
|
2022-08-08 15:56:44 +08:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count>0)
|
2022-08-08 16:18:42 +08:00
|
|
|
gameboard[i][j].setType(count);
|
2022-08-08 15:56:44 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
Block::Block() {
|
|
|
|
mX = 0;
|
|
|
|
mY = 0;
|
|
|
|
mRevealed = false;
|
|
|
|
mMarked = false;
|
|
|
|
mType = 0;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
Block::Block(int x, int y, int btype) {
|
|
|
|
mX = x;
|
|
|
|
mY = y;
|
|
|
|
mRevealed = false;
|
|
|
|
mMarked = false;
|
|
|
|
mType = btype;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
// Mutators
|
|
|
|
///////////////////////
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
void Block::setX(int x) {
|
|
|
|
mX = x;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
void Block::setY(int y) {
|
|
|
|
mY = y;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
void Block::setRevealed(bool reveal) {
|
|
|
|
mRevealed = reveal;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
void Block::setMarked(bool mark) {
|
|
|
|
mMarked = mark;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
void Block::setType(int btype) {
|
|
|
|
mType = btype;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
// Accessors
|
|
|
|
///////////////////////
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
int Block::getX() {
|
|
|
|
return mX;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
int Block::getY() {
|
|
|
|
return mY;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
bool Block::isRevealed() {
|
|
|
|
return mRevealed;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
bool Block::isMarked() {
|
|
|
|
return mMarked;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|
2022-08-08 16:18:42 +08:00
|
|
|
int Block::getType() {
|
|
|
|
return mType;
|
2022-08-08 15:56:44 +08:00
|
|
|
}
|
|
|
|
|