This commit is contained in:
mike
2026-01-23 03:37:54 +01:00
parent 4b61205bbb
commit ed7cade1c7
9 changed files with 150 additions and 155 deletions

View File

@@ -6,7 +6,6 @@ import lombok.experimental.Delegate;
import lombok.val;
import precomp.Const9x8.Cell;
import puzzle.Export.Puzzle.Replacar.Rell;
import puzzle.Masker.Clues;
import puzzle.Meta.ShardLem;
import puzzle.SwedishGenerator.Dict;
import puzzle.SwedishGenerator.FillResult;
@@ -18,7 +17,7 @@ import static precomp.Const9x8.INIT_GRID_OUTPUT;
import static precomp.Const9x8.INIT_GRID_OUTPUT_ARR;
import static puzzle.Export.Clue.DOWN0;
import static puzzle.Export.Clue.RIGHT1;
import static puzzle.Masker.Clues.createEmpty;
import static puzzle.Clues.createEmpty;
import static puzzle.Masker.Slot;
import static puzzle.Masker.C;
import static puzzle.SwedishGenerator.Lemma;
@@ -73,7 +72,7 @@ public record Export() {
public Signa deepCopyGrid() { return new Signa(new Clues(c.lo, c.hi, c.vlo, c.vhi, c.rlo, c.rhi, c.xlo, c.xhi)); }
String gridToString() {
var sb = new StringBuilder(INIT_GRID_OUTPUT);
forEachSlot((s, _, _) -> {
Masker.forEachSlot(c, (s, _, _) -> {
val idx = Slot.clueIndex(s);
val dir = Slot.dir(s);
sb.setCharAt(INDEX(INDEX_ROW(idx), C + 1, INDEX_COL(idx)), CLUE_CHAR(dir));
@@ -106,7 +105,7 @@ public record Export() {
record Puzzle(@Delegate Grid grid, Clues cl)
implements Stream<Lettrix> {
public Puzzle(Clues clues) { this(clues.toGrid(), clues); }
public Puzzle(Clues clues) { this(Masker.toGrid(clues), clues); }
public Puzzle(Signa clues) { this(clues.c); }
public @Delegate Stream<Lettrix> stream() {
val stream = Stream.<Lettrix>builder();
@@ -116,7 +115,7 @@ public record Export() {
}
String gridToString() {
var sb = INIT_GRID_OUTPUT_ARR.clone();
cl.forEachSlot((s, _, _) -> {
Masker.forEachSlot(cl, (s, _, _) -> {
val idx = Slot.clueIndex(s);
val r = idx & 7;
val c = idx >>> 3;
@@ -128,7 +127,7 @@ public record Export() {
}
public String[] exportGrid(Replacar clueChar, char emptyFallback) {
var sb = INIT_GRID_OUTPUT_ARR.clone();
cl.forEachSlot((s, l, a) -> {
Masker.forEachSlot(cl, (s, l, a) -> {
val idx = Slot.clueIndex(s);
val r = idx & 7;
val c = idx >>> 3;