Skip to content

Commit

Permalink
wip perf
Browse files Browse the repository at this point in the history
  • Loading branch information
meikpiep committed Oct 26, 2024
1 parent f35fcd0 commit caa4627
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object ImpossibleCombinationInLineDetector {
fun fillCells(
grid: Grid,
cache: PossiblesCache,
isImpossible: (Grid, GridLine, GridCage, cache: PossiblesCache, List<Int>) -> Boolean,
isImpossible: (GridLine, GridCage, cache: PossiblesCache, List<Int>) -> Boolean,
): Boolean {
val lines = GridLines(grid).linesWithEachPossibleValue()

Expand Down Expand Up @@ -58,7 +58,7 @@ object ImpossibleCombinationInLineDetector {
logger.trace { "Relevant line indexes: $lineCageCellsIndexes" }
logger.trace { "Single possible: $singlePossible" }

if (singlePossible.isNotEmpty() && isImpossible.invoke(grid, line, cage, cache, singlePossible)) {
if (singlePossible.isNotEmpty() && isImpossible.invoke(line, cage, cache, singlePossible)) {
cell.removePossible(singleCombinationPossible)
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class RemoveImpossibleCombinationInLineBecauseOfPossiblesOfOtherCage : HumanSolv
): Boolean = ImpossibleCombinationInLineDetector.fillCells(grid, cache, this::isImpossible)

private fun isImpossible(
grid: Grid,
line: GridLine,
cage: GridCage,
cache: PossiblesCache,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class RemoveImpossibleCombinationInLineBecauseOfSingleCell : HumanSolverStrategy
): Boolean = ImpossibleCombinationInLineDetector.fillCells(grid, cache, this::isImpossible)

private fun isImpossible(
grid: Grid,
line: GridLine,
cage: GridCage,
cache: PossiblesCache,
Expand Down

0 comments on commit caa4627

Please sign in to comment.