This repository was archived by the owner on Feb 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSettings.cpp
More file actions
55 lines (48 loc) · 1.3 KB
/
Settings.cpp
File metadata and controls
55 lines (48 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "Settings.h"
#include <cstdlib>
#include <time.h>
Settings::Settings(Difficulty diff) : difficulty(diff) {
switch (diff) {
case Beginner:
this->sizeLength = 8;
this->sizeWidth = 8;
this->percentageMines = 16;
this->numberOfMines = 10;
break;
case Medium:
this->sizeLength = 16;
this->sizeWidth = 16;
this->percentageMines = 16;
this->numberOfMines = 40;
break;
case Professional:
this->sizeLength = 30;
this->sizeWidth = 16;
this->percentageMines = 21;
this->numberOfMines = 99;
break;
}
this->fullGridSize = this->sizeLength * this->sizeWidth;
/*
srand(time(NULL));
this->numberOfMines = (this->fullGridSize * (rand() % this->percentageMines)) / 100;
*/
}
int Settings::getLength() const {
return this->sizeLength;
}
int Settings::getWidth() const {
return this->sizeWidth;
}
Difficulty Settings::getDifficulty() const {
return this->difficulty;
}
int Settings::getNumberOfMines() const {
return this->numberOfMines;
}
int Settings::getPercentageMines() const {
return this->percentageMines;
}
int Settings::getFullSize() const {
return this->fullGridSize;
}