introduce bitloops

This commit is contained in:
mike
2026-01-14 03:46:36 +01:00
parent 19f235ae59
commit eeae90a886
6 changed files with 19 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ package puzzle;
import lombok.val;
import org.junit.jupiter.api.Test;
import puzzle.Export.Clued;
import puzzle.Export.Gridded;
import puzzle.Export.Placed;
import puzzle.Export.Rewards;
@@ -27,7 +28,7 @@ public class ExportFormatTest {
@Test
void testExportFormatFromFilled() {
var swe = new SwedishGenerator(new Rng(0), new int[STACK_SIZE]);
var swe = new SwedishGenerator(new Rng(0), new int[STACK_SIZE]);
val clues = Clues.createEmpty();
// Place a RIGHT clue at (0,0)
@@ -35,8 +36,7 @@ public class ExportFormatTest {
// 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 grid = clues.toGrid();
var clueMap = new long[300];
// key = (cellIndex << 2) | (direction)
@@ -48,10 +48,9 @@ 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');
var fillResult = new FillResult(true, new Gridded(grid), clueMap, new FillStats(0, 0, 0, 0));
var puzzleResult = new PuzzleResult(swe, null, null, fillResult);
var puzzleResult = new PuzzleResult(swe, null, new Clued(clues), fillResult);
var rewards = new Rewards(10, 5, 1);
var exported = puzzleResult.exportFormatFromFilled(2, rewards);
@@ -90,8 +89,9 @@ public class ExportFormatTest {
void testExportFormatEmpty() {
var swe = new SwedishGenerator(new Rng(0), new int[STACK_SIZE]);
var grid = Grid.createEmpty();
val clues = Clues.createEmpty();
var fillResult = new FillResult(true, new Gridded(grid), new long[300], new FillStats(0, 0, 0, 0));
var puzzleResult = new PuzzleResult(swe, null, null, fillResult);
var puzzleResult = new PuzzleResult(swe, null, new Clued(clues), fillResult);
var exported = puzzleResult.exportFormatFromFilled(1, new Rewards(0, 0, 0));