introduce bitloops

This commit is contained in:
mike
2026-01-14 03:30:19 +01:00
parent b0b10d356a
commit 19f235ae59
6 changed files with 123 additions and 142 deletions

View File

@@ -1,5 +1,6 @@
package puzzle;
import lombok.val;
import org.junit.jupiter.api.Test;
import puzzle.Export.Gridded;
import puzzle.Export.Placed;
@@ -27,11 +28,15 @@ public class ExportFormatTest {
@Test
void testExportFormatFromFilled() {
var swe = new SwedishGenerator(new Rng(0), new int[STACK_SIZE]);
var grid = Grid.createEmpty();
val clues = Clues.createEmpty();
// Place a RIGHT clue at (0,0)
grid.setClue(0, CLUE_RIGHT);
clues.setClue(0, CLUE_RIGHT);
// This creates a slot starting at (0,1)
// Terminate the slot at (0,5) with another digit to avoid it extending to MAX_WORD_LENGTH
clues.setClue(Grid.offset(0, 5), CLUE_LEFT);
var grid = clues.toGrid();
var clueMap = new long[300];
// key = (cellIndex << 2) | (direction)
@@ -43,8 +48,7 @@ public class ExportFormatTest {
grid.setLetter(Grid.offset(0, 2), (byte) 'E');
grid.setLetter(Grid.offset(0, 3), (byte) 'S');
grid.setLetter(Grid.offset(0, 4), (byte) 'T');
// Terminate the slot at (0,5) with another digit to avoid it extending to MAX_WORD_LENGTH
grid.setClue(Grid.offset(0, 5), CLUE_LEFT);
var fillResult = new FillResult(true, new Gridded(grid), clueMap, new FillStats(0, 0, 0, 0));
var puzzleResult = new PuzzleResult(swe, null, null, fillResult);