Bugfixes: Now Always deploys 99 Bombs and doesnt print random number in [0][0]
This commit is contained in:
parent
ebb8e43e32
commit
e95f7f74d2
@ -18,14 +18,19 @@ struct MineSweeperBoard {
|
||||
}
|
||||
void spreadBombs() {
|
||||
while (bombCounter < 99) {
|
||||
field[getRandomNumberInRange(0,15)][getRandomNumberInRange(0,15)] = "x";
|
||||
bombCounter++;
|
||||
short x = getRandomNumberInRange(0,15);
|
||||
short y = getRandomNumberInRange(0,15);
|
||||
if (field[x][y] != "x") {
|
||||
field[x][y] = "x";
|
||||
bombCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string countNeighbourBombs(int i, int j) {
|
||||
i--;
|
||||
j--;
|
||||
int counter;
|
||||
int counter = 0;
|
||||
// int counter; // Not setting this nerd to 0 can cause a bug
|
||||
for (int k = 0; k < 3; k++) {
|
||||
for (int l = 0; l < 3; l++) {
|
||||
if ((i+k < 16) && (j+l < 16) && (i-l >= 0) && (j-l >= 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user