introduce bitloops

This commit is contained in:
mike
2026-01-20 07:08:31 +01:00
parent 47ead135d3
commit a764f45041
83 changed files with 205106 additions and 175 deletions

View File

@@ -24,6 +24,7 @@ import static puzzle.SwedishGenerator.FillStats;
import static puzzle.SwedishGenerator.R;
import static puzzle.Masker.Slot;
import static puzzle.GridBuilder.placeWord;
import static puzzle.SwedishGenerator.THRESS;
import static puzzle.SwedishGeneratorTest.OFF_0_1;
import static puzzle.SwedishGeneratorTest.OFF_0_2;
import static puzzle.SwedishGeneratorTest.OFF_0_3;
@@ -51,7 +52,7 @@ public class ExportFormatTest {
var fillResult = new FillResult(true, 0, 0, 0, 0, new FillStats());
var puzzleResult = new PuzzleResult(new Clued(clues), grid, new Slotinfo[]{
new Slotinfo(key, lo, 0L, 0, new Assign(TEST), null, 0)
}, fillResult);
}, fillResult, 0);
var rewards = new Rewards(10, 5, 1);
var exported = puzzleResult.exportFormatFromFilled(2, rewards);
@@ -91,7 +92,7 @@ public class ExportFormatTest {
var grid = SwedishGeneratorTest.createEmpty();
val clues = Clues.createEmpty();
var fillResult = new FillResult(true, 0, 0, 0, 0, new FillStats());
var puzzleResult = new PuzzleResult(new Clued(clues), new Gridded(grid, clues), new Slotinfo[0], fillResult);
var puzzleResult = new PuzzleResult(new Clued(clues), new Gridded(grid, clues), new Slotinfo[0], fillResult, 0);
var exported = puzzleResult.exportFormatFromFilled(1, new Rewards(0, 0, 0));
@@ -104,6 +105,10 @@ public class ExportFormatTest {
assertTrue(row.matches("#+"));
}
}
Path shardKey(long word) {
return Path.of("src/main/generated-sources/puzzle").resolve(Lemma.unpackSize(word) + 1 + ".idx");
}
@Test
void testShardToClue() {
for (int length = 2; length <= 8; length++) {
@@ -114,7 +119,7 @@ public class ExportFormatTest {
val wordVal = words[i];
val word = Lemma.asWord(wordVal, Export.BYTES.get());
val assigned = new Assign(wordVal);
val shard = Meta.shardKey(assigned.w);
val shard = shardKey(assigned.w);
val clueRec = Meta.readRecord(shard, i);
assertNotNull(clueRec);
@@ -146,7 +151,7 @@ public class ExportFormatTest {
}
if (idx != -1) {
val shard = Meta.shardKey(w);
val shard = shardKey(w);
val clueRec = Meta.readRecord(shard, idx);
assertNotNull(clueRec);
assertEquals(wStr, Lemma.asWord(clueRec.w(), Export.BYTES.get()));