introduce bitloops

This commit is contained in:
mike
2026-01-16 23:42:50 +01:00
parent 5c7d1120db
commit aceaa0fc18
5 changed files with 78 additions and 50 deletions

View File

@@ -21,6 +21,7 @@ import static puzzle.SwedishGenerator.R;
import static puzzle.SwedishGenerator.Lemma; import static puzzle.SwedishGenerator.Lemma;
import static puzzle.SwedishGenerator.Slot; import static puzzle.SwedishGenerator.Slot;
import static puzzle.SwedishGenerator.C; import static puzzle.SwedishGenerator.C;
import static puzzle.SwedishGenerator.X;
/** /**
* ExportFormat.java * ExportFormat.java
@@ -43,8 +44,11 @@ public record Export() {
static final String INIT = IntStream.range(0, R).mapToObj(l_ -> " ").collect(Collectors.joining("\n")); static final String INIT = IntStream.range(0, R).mapToObj(l_ -> " ").collect(Collectors.joining("\n"));
public record Clued(@Delegate Clues mask) { public record ClueAt(int index, int clue) { }
public record Clued(@Delegate Clues c) {
public Clued deepCopyGrid() { return new Clued(new Clues(c.lo, c.hi, c.vlo, c.vhi, c.rlo, c.rhi)); }
String gridToString() { String gridToString() {
var sb = new StringBuilder(INIT); var sb = new StringBuilder(INIT);
forEachSlot((s, l, a) -> { forEachSlot((s, l, a) -> {
@@ -56,6 +60,19 @@ public record Export() {
}); });
return sb.toString(); return sb.toString();
} }
public Stream<ClueAt> stream() {
val stream = Stream.<ClueAt>builder();
for (var l = c.lo & ~c.rlo & c.vlo ; l != X; l &= l - 1) stream.accept(new ClueAt(Long.numberOfTrailingZeros(l), 1));
for (var l = c.lo & ~c.rlo & ~c.vlo ; l != X; l &= l - 1) stream.accept(new ClueAt(Long.numberOfTrailingZeros(l), 0));
for (var l = c.lo & c.rlo & ~c.vlo ; l != X; l &= l - 1) stream.accept(new ClueAt(Long.numberOfTrailingZeros(l), 2));
for (var l = c.lo & c.rlo & c.vlo ; l != X; l &= l - 1) stream.accept(new ClueAt(Long.numberOfTrailingZeros(l), 3));
for (var h = c.hi & ~c.rhi & c.vhi ; h != X; h &= h - 1) stream.accept(new ClueAt(64 | Long.numberOfTrailingZeros(h), 1));
for (var h = c.hi & ~c.rhi & ~c.vhi ; h != X; h &= h - 1) stream.accept(new ClueAt(64 | Long.numberOfTrailingZeros(h), 0));
for (var h = c.hi & c.rhi & ~c.vhi ; h != X; h &= h - 1) stream.accept(new ClueAt((64 | Long.numberOfTrailingZeros(h)), 2));
for (var h = c.hi & c.rhi & c.vhi ; h != X; h &= h - 1) stream.accept(new ClueAt((64 | Long.numberOfTrailingZeros(h)), 3));
return stream.build();
}
} }
@FunctionalInterface @FunctionalInterface
@@ -74,13 +91,13 @@ public record Export() {
public Stream<LetterAt> stream(Clues clues) { public Stream<LetterAt> stream(Clues clues) {
val stream = Stream.<LetterAt>builder(); val stream = Stream.<LetterAt>builder();
for (var l = grid.lo & ~clues.lo; l != SwedishGenerator.X; l &= l - 1) stream.accept(LetterAt.from(Long.numberOfTrailingZeros(l), grid.g)); for (var l = grid.lo & ~clues.lo; l != X; l &= l - 1) stream.accept(LetterAt.from(Long.numberOfTrailingZeros(l), grid.g));
for (var h = grid.hi & ~clues.hi; h != SwedishGenerator.X; h &= h - 1) stream.accept(LetterAt.from(64 | Long.numberOfTrailingZeros(h), grid.g)); for (var h = grid.hi & ~clues.hi; h != X; h &= h - 1) stream.accept(LetterAt.from(64 | Long.numberOfTrailingZeros(h), grid.g));
return stream.build(); return stream.build();
} }
public void forEachLetter(Clues clues, LetterVisit visitor) { public void forEachLetter(Clues clues, LetterVisit visitor) {
for (var l = grid.lo & ~clues.lo; l != SwedishGenerator.X; l &= l - 1) visitor.visit(Long.numberOfTrailingZeros(l), grid.g); for (var l = grid.lo & ~clues.lo; l != X; l &= l - 1) visitor.visit(Long.numberOfTrailingZeros(l), grid.g);
for (var h = grid.hi & ~clues.hi; h != SwedishGenerator.X; h &= h - 1) visitor.visit(64 | Long.numberOfTrailingZeros(h), grid.g); for (var h = grid.hi & ~clues.hi; h != X; h &= h - 1) visitor.visit(64 | Long.numberOfTrailingZeros(h), grid.g);
} }
public static IntStream walk(byte base, long lo, long hi) { public static IntStream walk(byte base, long lo, long hi) {
if (Slot.increasing(base)) { if (Slot.increasing(base)) {
@@ -227,7 +244,7 @@ public record Export() {
// If nothing placed: return full grid mapped to letters/# only // If nothing placed: return full grid mapped to letters/# only
if (placed.isEmpty()) { if (placed.isEmpty()) {
return new ExportedPuzzle(g.exportGrid(clues.mask, _ -> '#', '#'), new WordOut[0], difficulty, rewards); return new ExportedPuzzle(g.exportGrid(clues.c, _ -> '#', '#'), new WordOut[0], difficulty, rewards);
} }
// 2) bounding box around all word cells + arrow cells, with 1-cell margin // 2) bounding box around all word cells + arrow cells, with 1-cell margin
@@ -251,7 +268,7 @@ public record Export() {
// 3) map of only used letter cells (everything else becomes '#') // 3) map of only used letter cells (everything else becomes '#')
var letterAt = new HashMap<Integer, Character>(); var letterAt = new HashMap<Integer, Character>();
g.forEachLetter(clues.mask(), (idx, letter) -> { g.forEachLetter(clues.c(), (idx, letter) -> {
if (letter == 0) return; if (letter == 0) return;
letterAt.put(idx, (char) (64 | letter)); letterAt.put(idx, (char) (64 | letter));
}); });

View File

@@ -104,10 +104,10 @@ public class Main {
System.out.print(indentLines(res.clues().gridToString(), " ")); System.out.print(indentLines(res.clues().gridToString(), " "));
section("Grid (raw)"); section("Grid (raw)");
System.out.print(indentLines(res.filled().grid().gridToString(res.clues().mask()), " ")); System.out.print(indentLines(res.filled().grid().gridToString(res.clues().c()), " "));
section("Grid (human)"); section("Grid (human)");
System.out.print(indentLines(res.filled().grid().renderHuman(res.clues().mask()), " ")); System.out.print(indentLines(res.filled().grid().renderHuman(res.clues().c()), " "));
var exported = res.exportFormatFromFilled(1, new Rewards(50, 2, 1)); var exported = res.exportFormatFromFilled(1, new Rewards(50, 2, 1));

View File

@@ -9,6 +9,7 @@ import lombok.val;
import precomp.Neighbors9x8; import precomp.Neighbors9x8;
import precomp.Neighbors9x8.rci; import precomp.Neighbors9x8.rci;
import puzzle.Export.Bit1029; import puzzle.Export.Bit1029;
import puzzle.Export.ClueAt;
import puzzle.Export.DictEntryDTO; import puzzle.Export.DictEntryDTO;
import puzzle.Export.Gridded; import puzzle.Export.Gridded;
import puzzle.Export.Strings; import puzzle.Export.Strings;
@@ -178,7 +179,6 @@ public record SwedishGenerator(Rng rng, int[] stack, Clues cache) {
long lo, hi, vlo, vhi, rlo, rhi; long lo, hi, vlo, vhi, rlo, rhi;
public static Clues createEmpty() { return new Clues(0, 0, 0, 0, 0, 0); } public static Clues createEmpty() { return new Clues(0, 0, 0, 0, 0, 0); }
public Clues deepCopyGrid() { return new Clues(lo, hi, vlo, vhi, rlo, rhi); }
boolean cluelessLo(int idx) { boolean cluelessLo(int idx) {
if (!isClueLo(idx)) return false; if (!isClueLo(idx)) return false;
clearClueLo(~(1L << idx)); clearClueLo(~(1L << idx));
@@ -205,18 +205,13 @@ public record SwedishGenerator(Rng rng, int[] stack, Clues cache) {
if ((idx & 2) != 0) rhi |= mask; if ((idx & 2) != 0) rhi |= mask;
else rhi &= ~mask; else rhi &= ~mask;
} }
public byte digitAtRevLo(int idx) { return (byte) (2 | ((vlo >>> idx) & 1L)); } int digitAtLo(int idx) { return (int) ((((rlo >>> idx) & 1L) << 1) | ((vlo >>> idx) & 1L)); }
public byte digitAtRevHi(int idx) { return (byte) (2 | ((vhi >>> (idx & 63)) & 1L)); } void clearClueLo(long mask) {
public byte digitAtDevLo(int idx) { return (byte) ((vlo >>> idx) & 1L); }
public byte digitAtDevHi(int idx) { return (byte) ((vhi >>> (idx & 63)) & 1L); }
public int digitAtHi(int idx) { return (int) ((((rhi >>> idx) & 1L) << 1) | ((vhi >>> idx) & 1L)); }
public int digitAtLo(int idx) { return (int) ((((rlo >>> idx) & 1L) << 1) | ((vlo >>> idx) & 1L)); }
public void clearClueLo(long mask) {
lo &= mask; lo &= mask;
vlo &= mask; vlo &= mask;
rlo &= mask; rlo &= mask;
} }
public void clearClueHi(long mask) { void clearClueHi(long mask) {
hi &= mask; hi &= mask;
vhi &= mask; vhi &= mask;
rhi &= mask; rhi &= mask;
@@ -239,8 +234,8 @@ public record SwedishGenerator(Rng rng, int[] stack, Clues cache) {
for (var l = lo & ~rlo & ~vlo; l != X; l &= l - 1) processSlot(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 0)); for (var l = lo & ~rlo & ~vlo; l != X; l &= l - 1) processSlot(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 0));
for (var l = lo & rlo & ~vlo; l != X; l &= l - 1) processSlotRev(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 2)); for (var l = lo & rlo & ~vlo; l != X; l &= l - 1) processSlotRev(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 2));
for (var l = lo & rlo & vlo; l != X; l &= l - 1) processSlotRev(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 3)); for (var l = lo & rlo & vlo; l != X; l &= l - 1) processSlotRev(this, visitor, Slot.packSlotKey(Long.numberOfTrailingZeros(l), 3));
for (var h = hi & ~rhi & vlo; h != X; h &= h - 1) processSlot(this, visitor, Slot.packSlotKey(64 | Long.numberOfTrailingZeros(h), 1)); for (var h = hi & ~rhi & vhi; h != X; h &= h - 1) processSlot(this, visitor, Slot.packSlotKey(64 | Long.numberOfTrailingZeros(h), 1));
for (var h = hi & ~rhi & ~vlo; h != X; h &= h - 1) processSlot(this, visitor, Slot.packSlotKey(64 | Long.numberOfTrailingZeros(h), 0)); for (var h = hi & ~rhi & ~vhi; h != X; h &= h - 1) processSlot(this, visitor, Slot.packSlotKey(64 | Long.numberOfTrailingZeros(h), 0));
for (var h = hi & rhi & ~vhi; h != X; h &= h - 1) processSlotRev(this, visitor, Slot.packSlotKey((64 | Long.numberOfTrailingZeros(h)), 2)); for (var h = hi & rhi & ~vhi; h != X; h &= h - 1) processSlotRev(this, visitor, Slot.packSlotKey((64 | Long.numberOfTrailingZeros(h)), 2));
for (var h = hi & rhi & vhi; h != X; h &= h - 1) processSlotRev(this, visitor, Slot.packSlotKey((64 | Long.numberOfTrailingZeros(h)), 3)); for (var h = hi & rhi & vhi; h != X; h &= h - 1) processSlotRev(this, visitor, Slot.packSlotKey((64 | Long.numberOfTrailingZeros(h)), 3));
} }
@@ -628,7 +623,7 @@ public record SwedishGenerator(Rng rng, int[] stack, Clues cache) {
else maskHi |= (1L << (i - 64)); else maskHi |= (1L << (i - 64));
} }
} }
var out = new Clues( var c = new Clues(
(a.lo & ~maskLo) | (other.lo & maskLo), (a.lo & ~maskLo) | (other.lo & maskLo),
(a.hi & ~maskHi) | (other.hi & maskHi), (a.hi & ~maskHi) | (other.hi & maskHi),
(a.vlo & ~maskLo) | (other.vlo & maskLo), (a.vlo & ~maskLo) | (other.vlo & maskLo),
@@ -636,12 +631,22 @@ public record SwedishGenerator(Rng rng, int[] stack, Clues cache) {
(a.rlo & ~maskLo) | (other.rlo & maskLo), (a.rlo & ~maskLo) | (other.rlo & maskLo),
(a.rhi & ~maskHi) | (other.rhi & maskHi)); (a.rhi & ~maskHi) | (other.rhi & maskHi));
for (var lo = out.lo; lo != X; lo &= lo - 1L) clearCluesLo(out, Long.numberOfTrailingZeros(lo)); // for (var lo = c.lo; lo != X; lo &= lo - 1L) clearCluesLo(c, Long.numberOfTrailingZeros(lo));
for (var hi = out.hi; hi != X; hi &= hi - 1L) clearCluesHi(out, Long.numberOfTrailingZeros(hi)); // for (var hi = c.hi; hi != X; hi &= hi - 1L) clearCluesHi(c, Long.numberOfTrailingZeros(hi));
return out;
for (var l = c.lo & ~c.rlo & ~c.vlo ; l != X; l &= l - 1) clearCluesLo(c,Long.numberOfTrailingZeros(l), 0);
for (var l = c.lo & ~c.rlo & c.vlo ; l != X; l &= l - 1) clearCluesLo(c,Long.numberOfTrailingZeros(l), 1);
for (var l = c.lo & c.rlo & ~c.vlo ; l != X; l &= l - 1) clearCluesLo(c,Long.numberOfTrailingZeros(l), 2);
for (var l = c.lo & c.rlo & c.vlo ; l != X; l &= l - 1) clearCluesLo(c,Long.numberOfTrailingZeros(l), 3);
for (var h = c.hi & ~c.rhi & ~c.vhi ; h != X; h &= h - 1) clearCluesHi(c, Long.numberOfTrailingZeros(h), 0);
for (var h = c.hi & ~c.rhi & c.vhi ; h != X; h &= h - 1) clearCluesHi(c, Long.numberOfTrailingZeros(h), 1);
for (var h = c.hi & c.rhi & ~c.vhi ; h != X; h &= h - 1) clearCluesHi(c,( Long.numberOfTrailingZeros(h)), 2);
for (var h = c.hi & c.rhi & ~c.vhi ; h != X; h &= h - 1) clearCluesHi(c,( Long.numberOfTrailingZeros(h)), 3);
return c;
} }
public static void clearCluesLo(Clues out, int idx) { if (!out.hasRoomForClue(OFFSETS_D_IDX[Slot.packSlotKey(idx, out.digitAtLo(idx))])) out.clearClueLo(~(1L << idx)); } public static void clearCluesLo(Clues out, int idx) { if (!out.hasRoomForClue(OFFSETS_D_IDX[Slot.packSlotKey(idx, out.digitAtLo(idx))])) out.clearClueLo(~(1L << idx)); }
public static void clearCluesHi(Clues out, int idx) { if (!out.hasRoomForClue(OFFSETS_D_IDX[Slot.packSlotKey(64 | idx, out.digitAtHi(idx))])) out.clearClueHi(~(1L << idx)); } public static void clearCluesLo(Clues out, int idx,int d) { if (!out.hasRoomForClue(OFFSETS_D_IDX[Slot.packSlotKey(idx, d)])) out.clearClueLo(~(1L << idx)); }
public static void clearCluesHi(Clues out, int idx,int d) { if (!out.hasRoomForClue(OFFSETS_D_IDX[Slot.packSlotKey(64 | idx, d)])) out.clearClueHi(~(1L << idx)); }
Clues hillclimb(Clues start, int clue_size, int limit) { Clues hillclimb(Clues start, int clue_size, int limit) {
var best = start; var best = start;

View File

@@ -3,12 +3,12 @@ package puzzle;
import lombok.val; import lombok.val;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import puzzle.Export.ClueAt;
import puzzle.Export.Clued; import puzzle.Export.Clued;
import puzzle.Export.Gridded; import puzzle.Export.Gridded;
import puzzle.Export.LetterVisit.LetterAt; import puzzle.Export.LetterVisit.LetterAt;
import puzzle.Export.PuzzleResult; import puzzle.Export.PuzzleResult;
import puzzle.Export.Rewards; import puzzle.Export.Rewards;
import puzzle.ExportFormatTest.Clue;
import puzzle.Main.Opts; import puzzle.Main.Opts;
import puzzle.SwedishGenerator.Rng; import puzzle.SwedishGenerator.Rng;
import puzzle.SwedishGenerator.Slot; import puzzle.SwedishGenerator.Slot;
@@ -95,17 +95,19 @@ public class MainTest {
} }
@Test @Test
public void testGridBasics() { public void testGridBasics() {
var clues = Clues.createEmpty(); var clues = new Clued(Clues.createEmpty());
val key = Slot.packSlotKey(OFF_2_1, CLUE_UP); val key = Slot.packSlotKey(OFF_2_1, CLUE_UP);
clues.setClueLo(IDX_2_1.lo, CLUE_UP); clues.setClueLo(IDX_2_1.lo, CLUE_UP);
var grid = new Gridded(clues.toGrid()); var grid = new Gridded(clues.toGrid());
// Test set/get // Test set/get
placeWord(grid.grid(), grid.grid().g, key, (1L << OFF_1_1) | (1L << OFF_0_1), 0, AZ); placeWord(grid.grid(), grid.grid().g, key, (1L << OFF_1_1) | (1L << OFF_0_1), 0, AZ);
val arr = grid.stream(clues).collect(Collectors.toMap(LetterAt::index, LetterAt::letter)); val map = grid.stream(clues.c()).collect(Collectors.toMap(LetterAt::index, LetterAt::letter));
Assertions.assertEquals(LETTER_A, arr.get(OFF_1_1)); Assertions.assertEquals(LETTER_A, map.get(OFF_1_1));
Assertions.assertEquals(LETTER_Z, arr.get(OFF_0_1)); Assertions.assertEquals(LETTER_Z, map.get(OFF_0_1));
Assertions.assertEquals(CLUE_UP, (byte) clues.digitAtLo(OFF_2_1)); var clueMap = clues.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(1, clueMap.size());
Assertions.assertEquals(CLUE_UP, clueMap.get(OFF_2_1));
// Test isLetterAt // Test isLetterAt
Assertions.assertTrue(clues.notClue(OFF_0_0)); Assertions.assertTrue(clues.notClue(OFF_0_0));
@@ -116,7 +118,8 @@ public class MainTest {
// Test isDigitAt // Test isDigitAt
Assertions.assertFalse(clues.isClueLo(OFF_0_0)); Assertions.assertFalse(clues.isClueLo(OFF_0_0));
Assertions.assertTrue(clues.isClueLo(OFF_2_1)); Assertions.assertTrue(clues.isClueLo(OFF_2_1));
Assertions.assertEquals(CLUE_UP, (byte) clues.digitAtLo(OFF_2_1)); clueMap = clues.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(CLUE_UP, clueMap.get(OFF_2_1));
Assertions.assertFalse(clues.isClueLo(OFF_2_3)); Assertions.assertFalse(clues.isClueLo(OFF_2_3));
Assertions.assertFalse(clues.isClueLo(OFF_1_1)); Assertions.assertFalse(clues.isClueLo(OFF_1_1));
@@ -127,18 +130,20 @@ public class MainTest {
} }
@Test @Test
public void testCluesDeepCopy() { public void testCluesDeepCopy() {
var grid = Clues.createEmpty(); var clues = new Clued(Clues.createEmpty());
grid.setClueLo(IDX_0_0.lo, RIGHT.dir); clues.setClueLo(IDX_0_0.lo, RIGHT.dir);
grid.setClueLo(IDX_0_1.lo, UP.dir); clues.setClueLo(IDX_0_1.lo, UP.dir);
grid.setClueLo(IDX_1_0.lo, LEFT.dir); clues.setClueLo(IDX_1_0.lo, LEFT.dir);
grid.setClueLo(IDX_1_1.lo, DOWN.dir); clues.setClueLo(IDX_1_1.lo, DOWN.dir);
var copy = grid.deepCopyGrid(); var copy = clues.deepCopyGrid();
Assertions.assertEquals(1, copy.digitAtLo(0)); var clueMap = clues.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(CLUE_RIGHT, clueMap.get(OFF_0_0));
copy.setClueLo(IDX_0_0.lo, DOWN.dir); copy.setClueLo(IDX_0_0.lo, DOWN.dir);
Assertions.assertEquals(DOWN.dir, copy.digitAtLo(0)); var copied = copy.stream().collect(Collectors.toMap(ClueAt::index, ClueAt::clue));
Assertions.assertEquals(1, grid.digitAtLo(0)); // Original should be unchanged Assertions.assertEquals(DOWN.dir, copied.get(OFF_0_0));
Assertions.assertEquals(RIGHT.dir, clueMap.get(OFF_0_0));
} }
@Test @Test
public void testMini() { public void testMini() {
@@ -198,9 +203,9 @@ public class MainTest {
System.out.println("[DEBUG_LOG] Simplicity: " + res.filled().stats().simplicity); System.out.println("[DEBUG_LOG] Simplicity: " + res.filled().stats().simplicity);
System.out.println("[DEBUG_LOG] ClueMap Size: " + res.filled().wordCount()); System.out.println("[DEBUG_LOG] ClueMap Size: " + res.filled().wordCount());
System.out.println("[DEBUG_LOG] Grid:"); System.out.println("[DEBUG_LOG] Grid:");
System.out.println(res.filled().grid().renderHuman(res.clues().mask())); System.out.println(res.filled().grid().renderHuman(res.clues().c()));
System.out.println(res.filled().grid().gridToString(res.clues().mask())); System.out.println(res.filled().grid().gridToString(res.clues().c()));
System.out.println(res.filled().grid().renderHuman(res.clues().mask())); System.out.println(res.filled().grid().renderHuman(res.clues().c()));
break; break;
} }
} }

View File

@@ -3,6 +3,7 @@ package puzzle;
import lombok.val; import lombok.val;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import puzzle.Export.Clued;
import puzzle.Export.Gridded; import puzzle.Export.Gridded;
import puzzle.Export.IntListDTO; import puzzle.Export.IntListDTO;
import puzzle.Export.LetterVisit.LetterAt; import puzzle.Export.LetterVisit.LetterAt;
@@ -317,16 +318,16 @@ public class SwedishGeneratorTest {
var rng = new Rng(42); var rng = new Rng(42);
var gen = new SwedishGenerator(rng, new int[STACK_SIZE], Clues.createEmpty()); var gen = new SwedishGenerator(rng, new int[STACK_SIZE], Clues.createEmpty());
var g1 = gen.randomMask(18); var c1 = new Clued(gen.randomMask(18));
assertNotNull(g1); assertNotNull(c1);
var g2 = gen.mutate(g1.deepCopyGrid()); var g2 = new Clued(gen.mutate(c1.deepCopyGrid().c()));
assertNotNull(g2); assertNotNull(g2);
assertNotSame(g1, g2); assertNotSame(c1.c(), g2.c());
assertNotNull(gen.crossover(g1, g2)); assertNotNull(gen.crossover(c1.c(), g2.c()));
var g4 = gen.hillclimb(g1, 18, 10); var g4 = gen.hillclimb(c1.c(), 18, 10);
assertNotNull(g4); assertNotNull(g4);
} }