27 lines
796 B
Kotlin
27 lines
796 B
Kotlin
package ch.dissem.yaep.domain
|
|
|
|
abstract class ClueTest {
|
|
protected val size = 6
|
|
|
|
protected fun createGrid(
|
|
selection: (Item<ItemClass<*>>) -> Item<ItemClass<*>>? = { it }
|
|
) = Grid(
|
|
ItemClass.randomClasses(size)
|
|
.map {
|
|
it.randomItems(size).map { item -> Item(item) }
|
|
}
|
|
.map { row ->
|
|
GameRow(
|
|
category = row.first().itemType.companion,
|
|
options = row,
|
|
cells = row.map {
|
|
GameCell(
|
|
selection = selection(it),
|
|
solution = it,
|
|
options = mutableListOf()
|
|
)
|
|
}
|
|
)
|
|
}
|
|
)
|
|
} |