Make special mechanics essential in postcard and story puzzles
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'postcard_patterns.dart';
|
||||
import 'postcard_tuned_givens.dart';
|
||||
import 'puzzle.dart';
|
||||
|
||||
/// A separate collection; it never changes a book's saved position.
|
||||
@@ -10,7 +11,7 @@ class IslandPostcard {
|
||||
|
||||
String puzzleKey(int slot) => 'postcard_v2_${id}_$slot';
|
||||
String legacyPuzzleKey(int slot) => 'postcard_v1_${id}_$slot';
|
||||
Puzzle puzzle(int slot) {
|
||||
Puzzle puzzle(int slot, {bool useTunedGivens = true}) {
|
||||
RangeError.checkValidIndex(slot, const [0, 1, 2]);
|
||||
final index = islandPostcards.indexOf(this);
|
||||
final (picture, clues) = postcardPatterns[index * puzzlesPerOuting + slot];
|
||||
@@ -55,6 +56,10 @@ class IslandPostcard {
|
||||
for (var row = 1; row < 7; row++) {
|
||||
if (board.rows[row] == board.rows[row - 1] + 1) {
|
||||
board.hiddenRow = row;
|
||||
board.hiddenColumn = index % 7;
|
||||
board.hiddenTotalCells.addAll([
|
||||
for (var c = 0; c < 3; c++) ((row + 3) % 7) * 7 + c * 2,
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -85,6 +90,24 @@ class IslandPostcard {
|
||||
}
|
||||
}
|
||||
}
|
||||
final tuned = postcardTunedGivens[index * puzzlesPerOuting + slot];
|
||||
final tunedPair = postcardTunedLanterns[index * puzzlesPerOuting + slot];
|
||||
if (useTunedGivens && tunedPair != null) {
|
||||
board.lanternPairs
|
||||
..clear()
|
||||
..add(LanternPair(tunedPair[0], tunedPair[1]));
|
||||
}
|
||||
final tunedTrail = postcardTunedTrails[index * puzzlesPerOuting + slot];
|
||||
if (useTunedGivens && tunedTrail != null) {
|
||||
board.footprintTrails
|
||||
..clear()
|
||||
..add(tunedTrail);
|
||||
}
|
||||
if (useTunedGivens && tuned != null) {
|
||||
for (var cell = 0; cell < board.given.length; cell++) {
|
||||
board.given[cell] = tuned.contains(cell);
|
||||
}
|
||||
}
|
||||
return board;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user