Skip to content

Commit

Permalink
🐛 negative flags number
Browse files Browse the repository at this point in the history
  • Loading branch information
Badr-1 committed Jan 1, 2023
1 parent 4d05ad4 commit f43245e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Binary file modified out/artifacts/mine_sweeper_jar/mine-sweeper.jar
Binary file not shown.
Binary file modified out/production/mine-sweeper/minesweeper/MineField$Cell.class
Binary file not shown.
Binary file modified out/production/mine-sweeper/minesweeper/MineField.class
Binary file not shown.
12 changes: 8 additions & 4 deletions src/main/kotlin/MineField.kt
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,14 @@ class MineField(private val numberOfMines: Int) {
if (!mineField[y][x].isExplored) {

if (!mineField[y][x].isMarked) {
mineField[y][x].isMarked = true
numberOfMarkers--
if (mineField[y][x].isMine) {
numberOfMarkedMines++
if (numberOfMarkers != 0) {
mineField[y][x].isMarked = true
numberOfMarkers--
if (mineField[y][x].isMine) {
numberOfMarkedMines++
}
} else {
println(red("You don't have any flags"))
}
} else {
mineField[y][x].isMarked = false
Expand Down

0 comments on commit f43245e

Please sign in to comment.