summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordawidg81 <dawidgorski.m@gmail.com>2026-02-02 14:24:40 +0100
committerdawidg81 <dawidgorski.m@gmail.com>2026-02-02 14:24:40 +0100
commit2aad1ecfe24b2eb5372eb16b13721e57f9f4a917 (patch)
tree1d95e2e57f4dfc80db11a21e81e3be6708d2d3f7 /src
parent67f1181e2c9227a3f33f9b6823ad48d33c1482e0 (diff)
Added flag char and tile dig with game controls
Diffstat (limited to 'src')
-rw-r--r--src/Game.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/Game.cpp b/src/Game.cpp
index d1386fe..aa42b9a 100644
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -99,6 +99,7 @@ int Game::editDiff(){
7 - revealed tile with 6 bomb around
8 - revealed tile with 7 bomb around
9 - revealed tile with 8 bomb around
+10 - flag
*/
@@ -113,25 +114,27 @@ void Game::displayBoard() {
for (int j = 0; j < boardWidth; j++) {
if (tileMap[i][j] == 0) {
putchar('#');
- } else if (tileMap[i][j] == 1) {
+ } else if(tileMap[i][j] == 1){
putchar('.');
- } else if (tileMap[i][j] == 2) {
+ } else if(tileMap[i][j] == 2){
putchar('1');
- } else if (tileMap[i][j] == 3) {
+ } else if(tileMap[i][j] == 3){
putchar('2');
- } else if (tileMap[i][j] == 4) {
+ } else if(tileMap[i][j] == 4){
putchar('3');
- } else if (tileMap[i][j] == 5) {
+ } else if(tileMap[i][j] == 5){
putchar('4');
- } else if (tileMap[i][j] == 6) {
+ } else if(tileMap[i][j] == 6){
putchar('5');
- } else if (tileMap[i][j] == 7) {
+ } else if(tileMap[i][j] == 7){
putchar('6');
- } else if (tileMap[i][j] == 8) {
+ } else if(tileMap[i][j] == 8){
putchar('7');
- } else if (tileMap[i][j] == 9) {
+ } else if(tileMap[i][j] == 9){
putchar('8');
- }
+ } else if(tileMap[i][j] == 10){
+ putchar('X');
+ }
}
putchar('\n');
}
@@ -150,10 +153,12 @@ void Game::input(){
int x, y;
std::cout << "Enter column and row where to dig: ";
std::cin >> x >> y;
+ tileMap[x][y] = 1;
} else if(input == "f"){
int x, y;
std::cout << "Enter column and row where to place flag: ";
std::cin >> x >> y;
+ tileMap[x][y] = 10;
} else {
std::cout << "Unknown command '" << input << "'.\n";
}