Add tests
This commit is contained in:
@@ -41,6 +41,7 @@ fun generateGame(size: Int = 6): Game {
|
||||
// (You can speed this up by removing clues in batches rather than one at a time, but it makes the algorithm more complicated to describe.)
|
||||
}
|
||||
|
||||
// FIXME: I need to better include the options into the solver (rule violations checks)
|
||||
private fun solve(
|
||||
grid: Grid,
|
||||
clues: Collection<Clue>
|
||||
@@ -121,13 +122,11 @@ fun <C : ItemClass<C>> GameRow<C>.cleanupOptions(cell: GameCell<C>) {
|
||||
|
||||
private fun getAllClues(rows: List<List<Item<ItemClass<*>>>>): MutableSet<Clue> {
|
||||
val clues = mutableSetOf<Clue>()
|
||||
// rows.forEach { row ->
|
||||
// row.forEachIndexed { i, item ->
|
||||
// clues.add(PositionClue(item, i))
|
||||
// }
|
||||
// }
|
||||
clues.add(PositionClue(rows.random().first(), 0))
|
||||
clues.add(PositionClue(rows.random()[3], 3))
|
||||
rows.forEach { row ->
|
||||
row.forEachIndexed { i, item ->
|
||||
clues.add(PositionClue(item, i))
|
||||
}
|
||||
}
|
||||
|
||||
rows.forEach { columns ->
|
||||
columns.forEachIndexed { j, item ->
|
||||
|
||||
Reference in New Issue
Block a user