diff options
| author | dawidg81 <dawidgorski.m@gmail.com> | 2026-01-28 18:14:21 +0100 |
|---|---|---|
| committer | dawidg81 <dawidgorski.m@gmail.com> | 2026-01-28 18:14:21 +0100 |
| commit | 4b27e7dc8fc6e540a3b1b9578592d07911a38237 (patch) | |
| tree | 960b0f11272406a7bdd1e37027a9f7cbb2ef6a0d /src | |
| parent | a51e8d4a24ff998fc184c39aa25009b28a0863c8 (diff) | |
merging Game class implementation into one file
Diffstat (limited to 'src')
| -rw-r--r-- | src/Game/Game.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 8f5d5f0..df49c6d 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -4,4 +4,41 @@ #include <cstdlib> #include <cstdio> #include <iostream> -#include <string>
\ No newline at end of file +#include <string> + +void Game::initDiff(int diff) { + switch (diff) { + case 0: + boardWidth = 9; + boardHeight = 9; + mines = 9; + break; + case 1: + boardWidth = 16; + boardHeight = 16; + mines = 12; + break; + case 2: + boardWidth = 30; + boardHeight = 16; + mines = 16; + break; + case 3: + std::cout << "Editing game parameters\n"; + break; + } +} + +void Game::initBoard() { + for (int i = 0; i < boardHeight; i++) { + for (int j = 0; j < boardWidth; j++) { + bombMap[i][j] = rand() % 2; + } + } + + for (int i = 0; i < boardHeight; i++) { + for (int j = 0; j < boardWidth; j++) { + tileMap[i][j] = 0; + } + } +}
\ No newline at end of file |
