Last condition makes no sense...
Can somebody explain the last condition?
Resolved
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Jon Hjerting
7 August 2019, 11:42
How did you understand the last condition?
It contradict the first condition. If the cell is not a mine and no neighbours has a mine, it should recursively call itself on each neigbhour, but the last condition says it should not call anything.
0
Mateo
13 July 2019, 18:19
just got it a few minutes ago, corrected my code according to your remarks,
still, thank you a lot
But regarding the requirements, i don't understand how that was explained in the last requirement, i call another method that takes coordinates and string.
0
Ewerton Backend Developer
13 July 2019, 17:09solution
1) When you create your game, on line 38, you count the neighbors of every element by calling your method getNeighbors and store the value on countMineNeighbors. On line 90, you have the value already, but you call your function to recalculate it.
2) On line 98, 99, you are going to open a cell, which is not a mine, and display its value, but if it's a 0, it shouldn't display anything, just an empty string.
+2
Jon Hjerting
7 August 2019, 11:40
countMineNeighbours is run on each cell during setup
so it should just be a value later on?
0