Improve domain (WIP)
This commit is contained in:
15
composeApp/src/commonMain/kotlin/domain/generator.kt
Normal file
15
composeApp/src/commonMain/kotlin/domain/generator.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package domain
|
||||
|
||||
fun generateGame(): Game {
|
||||
// Here's a simple algorithm making use of your solver:
|
||||
// 1. Generate a random puzzle instance.
|
||||
// 2. Build a set C of all possible clues that pertain to this puzzle instance. (There are a finite and in fact quite small number of possible clues: for example if there are 5 houses, there are 5 possible clues of the form "Person A lives in house B", 8 possible clues of the form "Person A lives next to house B", and so on.)
|
||||
// 3. Pick a random permutation c1, c2, ..., cn of the clues in C.
|
||||
// 4. Set i = 1.
|
||||
// 5. If i > n, we are done. The set C of clues is minimal.
|
||||
// 6. Let D = C − { ci }. Run your solver on the set D of clues and count the number of possible solutions.
|
||||
// 7. If there is exactly one solution, set C = D.
|
||||
// 8. Set i = i + 1 and go back to step 5.
|
||||
// (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.)
|
||||
TODO()
|
||||
}
|
||||
Reference in New Issue
Block a user