Enhance postcard puzzles and narration

This commit is contained in:
Hadrian Burkhardt
2026-11-14 08:55:48 +01:00
parent abaab927d9
commit b19295472d
158 changed files with 5257 additions and 1695 deletions
+18 -2
View File
@@ -195,6 +195,20 @@ void main() {
}
}
});
test('new 7x7 generated boards retain their grade, uniqueness and deterministic clues', () {
for (final d in Difficulty.values) {
for (var seed = 1000001; seed < 1000031; seed++) {
final p = Puzzle.generateSeven(BigInt.from(seed), d);
final repeat = Puzzle.generateSeven(BigInt.from(seed), d);
expect(p.size, 7);
expect(p.difficulty, d);
expect(p.countSolutions(), 1);
expect(LogicSolver(49, p.constraints).analyze(p.initial).solved, true);
expect(p.solution, repeat.solution);
expect(p.given, repeat.given);
}
}
});
test(
'area solver matches exhaustive enumeration for 300 random small systems',
() {
@@ -350,7 +364,8 @@ void main() {
final store = Progress.memory(), g = Game(await Book.load(), store);
g.startDaily(DateTime(2026, 10, 31));
final p = g.puzzle!;
for (var i = 0; i < 25; i++) {
expect(p.size, 7);
for (var i = 0; i < p.solution.length; i++) {
while (g.cells[i] != (p.solution[i] == 1 ? 1 : 2)) {
g.mark(i);
}
@@ -363,7 +378,8 @@ void main() {
await g.startPractice();
expect(g.puzzle!.difficulty, Difficulty.hard);
final hard = g.puzzle!;
for (var i = 0; i < 25; i++) {
expect(hard.size, 7);
for (var i = 0; i < hard.solution.length; i++) {
while (g.cells[i] != (hard.solution[i] == 1 ? 1 : 2)) {
g.mark(i);
}