introduce bitloops

This commit is contained in:
mike
2026-01-21 05:13:39 +01:00
parent 92a736aa0a
commit f203f2106e
11 changed files with 97 additions and 108 deletions

View File

@@ -13,6 +13,7 @@ import puzzle.Export.PuzzleResult;
import puzzle.Export.Rewards;
import puzzle.Main.Opts;
import puzzle.SwedishGenerator.Rng;
import puzzle.dict950.DictData950;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -140,15 +141,17 @@ public class MainTest {
}
@Test
void testFiller2() {
val mask = Clued.parse(
"1 000000\n" +
"1 \n" +
"1 \n" +
"3 3 \n" +
"3 0 3 \n" +
"3 \n" +
"3 \n" +
"222 3");
var mask = Clued.of(
r0c0d1,
r0c3d0, r0c4d0, r0c5d0, r0c6d0, r0c7d0, r0c8d0,
r1c0d1,
r2c0d1,
r3c0d3, r3c3d3,
r4c0d3, r4c3d0, r4c6d3,
r5c0d3,
r6c0d3,
r7c0d2, r7c1d2, r7c2d2, r7c8d3
);
Assertions.assertEquals(20, mask.clueCount());
val map = mask.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(20, map.size());
@@ -158,17 +161,19 @@ public class MainTest {
}
@Test
void testFiller() {
System.out.println(DictData950.DICT950.index().length);
val rng = new Rng(-343913721);
val mask = Clued.parse(
" 3 300\n" +
" 1 \n" +
" 1 \n" +
" 3 0 \n" +
" 31 \n" +
" 1 \n" +
" 1 2\n" +
"21 22 3");
var slotInfo = mask.slots();
var mask = Clued.of(
r0c3d3, r0c6d3, r0c7d0, r0c8d0,
r1c1d1,
r2c1d1,
r3c3d3, r3c6d0,
r4c2d3, r4c3d1,
r5c1d1,
r6c1d1, r6c8d2,
r7c0d2, r7c1d1, r7c4d2, r7c5d2, r7c8d3
);
var slotInfo = mask.slots(/*DictData950.DICT950*/);
var grid = Slotinfo.grid(slotInfo);
var filled = fillMask(rng, slotInfo, grid);
Assertions.assertTrue(filled.ok(), "Puzzle generation failed (not ok)");
@@ -177,7 +182,7 @@ public class MainTest {
Assertions.assertEquals(-1L, grid.lo);
Assertions.assertEquals(-1L, grid.hi);
var g = new Gridded(grid, mask.c());
g.gridToString(mask.c());
g.gridToString();
var aa = new PuzzleResult(mask, g, slotInfo, filled).exportFormatFromFilled(new Rewards(1, 1, 1));
System.out.println(String.join("\n", aa.grid()));
@@ -194,8 +199,8 @@ public class MainTest {
System.out.println("[DEBUG_LOG] Seed found: " + seed);
System.out.println("[DEBUG_LOG] ClueMap Size: " + Slotinfo.wordCount(0, res.slots()));
System.out.println("[DEBUG_LOG] Grid:");
System.out.println(res.grid().renderHuman(res.clues().c()));
System.out.println(res.grid().gridToString(res.clues().c()));
System.out.println(res.grid().renderHuman());
System.out.println(res.grid().gridToString());
break;
}
}