File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
minesweeper-engine/src/main/java/com/jayasuryat/minesweeperengine/controller/impl/handler Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com.jayasuryat.minesweeperengine.controller.impl.handler
2
+
3
+ import android.util.Log
4
+ import com.jayasuryat.minesweeperengine.model.cell.RawCell
5
+ import com.jayasuryat.minesweeperengine.model.grid.Grid
6
+
7
+ internal class GameSuccessEvaluator {
8
+
9
+ fun isGameComplete (
10
+ grid : Grid ,
11
+ ): Boolean {
12
+
13
+ val totalCount = grid.gridSize.rows * grid.gridSize.columns
14
+ val nonMineCellsCount = totalCount - grid.totalMines
15
+
16
+ val revealedCellsCount = grid.cells.flatten().count { it is RawCell .RevealedCell }
17
+ Log .d(" Im alive" , " Im alive, (revealedCellsCount) $revealedCellsCount == $nonMineCellsCount (nonMineCellsCount)" )
18
+ return revealedCellsCount == nonMineCellsCount
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments