introduce bitloops

This commit is contained in:
mike
2026-01-21 06:38:25 +01:00
parent dd53009e69
commit 1e13d39153
46 changed files with 51 additions and 150429 deletions

View File

@@ -16,7 +16,7 @@ import static puzzle.Export.Clue.DOWN0;
import static puzzle.Export.Clue.RIGHT1;
import static puzzle.Masker.Clues.createEmpty;
import static puzzle.Masker.Slot;
import static puzzle.SwedishGenerator.C;
import static puzzle.Masker.C;
import static puzzle.SwedishGenerator.Lemma;
import static puzzle.SwedishGenerator.X;
@@ -31,7 +31,7 @@ import static puzzle.SwedishGenerator.X;
*/
public record Export() {
public static final ThreadLocal<byte[]> BYTES = ThreadLocal.withInitial(() -> new byte[SwedishGenerator.MAX_WORD_LENGTH]);
public static final ThreadLocal<byte[]> BYTES = ThreadLocal.withInitial(() -> new byte[8]);
static final byte CLUE_DOWN = 0;
static final byte CLUE_RIGHT = 1;
static final byte CLUE_UP = 2;
@@ -101,9 +101,6 @@ public record Export() {
return stream.build();
}
public Slotinfo[] slots() {
return slots(DictData.DICT);
}
public Slotinfo[] slots(Dict D) {
return Masker.slots(c, D.index());
}
@@ -237,7 +234,8 @@ public record Export() {
return new ExportedPuzzle(grid.exportGrid(_ -> '#', '#'), new WordOut[0], 1, rewards);
}
var placed = Arrays.stream(slots).map(slot -> new Placed(slot.assign().w, slot.key(), Gridded.cellWalk((byte) slot.key(), slot.lo(), slot.hi()).toArray())).toArray(Placed[]::new);
var placed = Arrays.stream(slots).map(slot -> new Placed(slot.assign().w, slot.key(), Gridded.cellWalk((byte) slot.key(), slot.lo(), slot.hi()).toArray())).toArray(
Placed[]::new);
// 2) bounding box around all word cells + arrow cells, with 1-cell margin
int minR = Integer.MAX_VALUE, minC = Integer.MAX_VALUE;