Add tests

This commit is contained in:
Christian Basler
2024-06-24 18:42:39 +02:00
parent f76be158a0
commit 4c7cc68024
5 changed files with 66 additions and 33 deletions

View File

@@ -1,12 +1,7 @@
package domain
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
sealed class Clue {
abstract fun isRuleViolated(grid: Grid): Boolean
var isActive: Boolean by mutableStateOf(true)
}
sealed class HorizontalClue : Clue()
@@ -58,6 +53,10 @@ class TripletClue<C : ItemClass<C>>(val a: Item<C>, val b: Item<C>, val c: Item<
val rowC = grid[cType.companion]
for (i in 2 until grid.size) {
if (rowA[i-2].selection == a){
return rowB[i - 1].mayBe(b) &&
rowC[i - 0].mayBe(c)
}
if (rowA[i - 2].mayBe(a) &&
rowB[i - 1].mayBe(b) &&
rowC[i - 0].mayBe(c)