Gather data

This commit is contained in:
mike
2026-01-09 08:18:55 +01:00
parent 850fdb4f67
commit fa806a1078
4 changed files with 134 additions and 76 deletions

View File

@@ -21,7 +21,7 @@ public class ExportFormatTest {
var grid = SwedishGenerator.makeEmptyGrid();
// Place a '2' (right) at (0,0)
grid.setByteAt(0, (byte) '2');
grid.setClue(0, (byte) '2');
// This creates a slot starting at (0,1)
var clueMap = new HashMap<Integer, Lemma>();
@@ -36,7 +36,7 @@ public class ExportFormatTest {
grid.setByteAt(Grid.offset(0, 3), (byte) 'S');
grid.setByteAt(Grid.offset(0, 4), (byte) 'T');
// Terminate thGrid.offset(e slot at) (0,5) with another digit to avoid it extending to MAX_WORD_LENGTH
grid.setByteAt(Grid.offset(0, 5), (byte) '1');
grid.setClue(Grid.offset(0, 5), (byte) '1');
var fillResult = new FillResult(true, new Gridded(grid), clueMap, null);
var puzzleResult = new PuzzleResult(swe, null, null, fillResult);

View File

@@ -28,7 +28,7 @@ public class MainTest {
// Set up digits on the grid to create slots.
// '2' (right) at (0,0) -> slot at (0,1), (0,2)
grid.setCharAt(0, 0, '2');
grid.setClue(0, (byte) '2');
grid.setCharAt(0, 1, 'A');
grid.setCharAt(0, 2, 'B');
@@ -61,7 +61,7 @@ public class MainTest {
void testForEachSlot() {
var generator = new SwedishGenerator();
var grid = makeEmptyGrid();
grid.setCharAt(0, 0, '2'); // right
grid.setClue(0, (byte) '2'); // right
var count = new AtomicInteger(0);
generator.forEachSlot(grid, (key, packedPos, len) -> {
@@ -175,8 +175,8 @@ public class MainTest {
// Regression baseline for seed search starting at 12347, pop 4, gens 20
Assertions.assertEquals(12347, foundSeed, "Found seed changed");
Assertions.assertEquals(20, res.filled().clueMap().size(), "Number of assigned words changed");
Assertions.assertEquals(763.8, res.filled().simplicity(), 1e-9, "Simplicity value changed");
Assertions.assertArrayEquals(new byte[]{ 'M', 'A', 'N', 'T', 'A' }, res.filled().clueMap().get(1377).word());
Assertions.assertEquals(775.45, res.filled().simplicity(), 1e-9, "Simplicity value changed");
Assertions.assertArrayEquals(new byte[]{ 'I', 'N', 'E', 'R', 'T' }, res.filled().clueMap().get(1377).word());
}
@Test
public void testIsLetterA() {

View File

@@ -191,7 +191,7 @@ public class SwedishGeneratorTest {
var grid = SwedishGenerator.makeEmptyGrid();
// 3x3 grid (Config.PUZZLE_ROWS/COLS are 3 in test env)
// Set '2' (right) at 0,0
grid.setCharAt(0, 0, '2');
grid.setClue(0, (byte) '2');
// This should detect a slot starting at 0,1 with length 2 (0,1 and 0,2)
var slots = gen.extractSlots(grid);
@@ -226,7 +226,7 @@ public class SwedishGeneratorTest {
assertTrue(f1 >= 1_000_000_000L);
// Add a slot
grid.setCharAt(0, 0, '2');
grid.setClue(0, SwedishGenerator.OFFSETS[2].dbyte());
var f2 = gen.maskFitness(grid, lenCounts);
assertTrue(f2 < f1);
}