Gather data

This commit is contained in:
mike
2026-01-09 22:25:15 +01:00
parent 2ec023b49d
commit 183216e753
5 changed files with 75 additions and 73 deletions

View File

@@ -69,7 +69,7 @@ public class SwedishGeneratorTest {
@Test
void testGrid() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
grid.setCharAt(0, 0, 'A');
grid.setCharAt(0, 1, '1');
@@ -191,7 +191,7 @@ public class SwedishGeneratorTest {
@Test
void testForEachSlotAndExtractSlots() {
var gen = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// 3x3 grid (Config.PUZZLE_ROWS/COLS are 3 in test env)
// Set '2' (right) at 0,0
grid.setClue(0, (byte) '2');
@@ -219,7 +219,7 @@ public class SwedishGeneratorTest {
@Test
void testMaskFitnessBasic() {
var gen = new SwedishGenerator();
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
var lenCounts = new int[12];
lenCounts[2] = 10;
lenCounts[8] = 10; // In case MAX_WORD_LENGTH is 8
@@ -257,7 +257,7 @@ public class SwedishGeneratorTest {
@Test
void testPlaceWord() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// Slot at (0,0) length 3, horizontal (right)
// key = (r << 8) | (c << 4) | d. Here we just need a valid slot for placeWord.
// r(i) and c(i) are used by placeWord.
@@ -286,7 +286,7 @@ public class SwedishGeneratorTest {
assertEquals('C', grid.byteAt(0, 2));
// 4. Partial placement then conflict (rollback)
grid = SwedishGenerator.makeEmptyGrid();
grid = Grid.createEmpty();
grid.setCharAt(0, 2, 'X'); // Conflict at the end
assertFalse(SwedishGenerator.placeWord(grid, s, w1, undoBuffer, 3));
// Verify grid is still empty (except for 'X')
@@ -297,7 +297,7 @@ public class SwedishGeneratorTest {
@Test
void testBacktrackingHelpers() {
var grid = SwedishGenerator.makeEmptyGrid();
var grid = Grid.createEmpty();
// Slot at 0,1 length 2
var packedPos = ((long) Grid.offset(0, 1)) | (((long) Grid.offset(0, 2)) << 7);
var s = Slot.from((0 << 8) | (1 << 4) | 2, packedPos, 2);
@@ -310,7 +310,7 @@ public class SwedishGeneratorTest {
assertEquals('Z', grid.byteAt(0, 2));
assertEquals(0b11L, undoBuffer[0]);
SwedishGenerator.undoPlace(grid, s, undoBuffer[0]);
s.undoPlace(grid, undoBuffer[0]);
assertEquals(SwedishGenerator.DASH, grid.byteAt(0, 1));
assertEquals(SwedishGenerator.DASH, grid.byteAt(0, 2));
}