From 0d2cffff89dd0bf752cff5a5d8dbebc22a2dc01e Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Sun, 25 Jan 2026 15:03:01 +0100 Subject: added displayBoard and initialized tile map in game.cpp --- src/game/game.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/game/game.cpp b/src/game/game.cpp index eefbe02..80f25bf 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -14,8 +15,8 @@ private: int boardWidth; int boardHeight; - bool bombmap[MAX_H][MAX_W]; - int displaymap[MAX_H][MAX_W]; + bool bombMap[MAX_H][MAX_W]; + int tileMap[MAX_H][MAX_W]; int mines; @@ -75,7 +76,25 @@ public: void initBoard(){ for(int i = 0; i < boardHeight; i++){ for(int j = 0; j < boardWidth; j++){ - bombmap[i][j] = rand() % 2; + // false = no bomb; true = bomb; + bombMap[i][j] = rand() % 2; + } + } + + for (int i = 0; i < boardHeight; i++) { + for (int j = 0; j < boardWidth; j++) { + // 0 = unrevealed tile + // 1 = revealed tile + // from 2 to 10 - revealed tiles with numbers + tileMap[i][j] = 0; + } + } + } + + void displayBoard(){ + for (int i = 0; i < boardHeight; i++) { + for (int j = 0; j < boardWidth; j++) { + putchar(tileMap[i][j]); } } } -- cgit v1.2.3