introduce bitloops

This commit is contained in:
mike
2026-01-14 18:42:13 +01:00
parent 29aceb2180
commit 75f599318a
4 changed files with 48 additions and 35 deletions

View File

@@ -38,7 +38,9 @@ public class MainTest {
static final int OFF_2_3 = Grid.offset(2, 3);
static final Opts opts = new Main.Opts() {{
this.seed = 12348;
this.clueSize = 4;
this.pop = 4; // Tiny population
this.offspring = 18;
this.gens = 20; // Very few generations
this.minSimplicity = 0;
this.threads = 1;
@@ -159,19 +161,19 @@ public class MainTest {
@Test
void testMaskerCreation() {
var swe = new SwedishGenerator(new Rng(12348), new int[STACK_SIZE], Clues.createEmpty());
var mask = swe.generateMask(opts.pop, opts.gens, Math.max(opts.pop, (int) Math.floor(opts.pop * 1.5)));
var mask = swe.generateMask(opts.clueSize, opts.pop, opts.gens, opts.offspring);
val clued = new Clued(mask);
val test = clued.gridToString();
val RESULT = "001 \n" +
" 3 3\n" +
val RESULT = "1 \n" +
" \n" +
" 3\n" +
" 3\n" +
" 21 1 \n" +
" 3 \n" +
"221 1 \n" +
"1 22";
" \n" +
" \n" +
"1 \n" +
" \n" +
" 3";
Assertions.assertEquals(18, clued.clueCount(), "Found seed changed");
Assertions.assertEquals(4, clued.clueCount(), "Found seed changed");
Assertions.assertEquals(RESULT, test, "Found seed changed");
}
@Test