introduce bitloops
This commit is contained in:
@@ -24,8 +24,7 @@ import static puzzle.SwedishGeneratorTest.OFF_0_2;
|
||||
|
||||
public class MainTest {
|
||||
|
||||
|
||||
static final Opts opts = new Main.Opts() {{
|
||||
static final Opts opts = new Main.Opts() {{
|
||||
this.seed = 12348;
|
||||
this.clueSize = 4;
|
||||
this.pop = 4; // Tiny population
|
||||
@@ -36,7 +35,7 @@ public class MainTest {
|
||||
this.tries = 1;
|
||||
this.verbose = false;
|
||||
}};
|
||||
static final Dict dict = Dict.loadDict(opts.wordsPath);
|
||||
static final Dict dict = Dict.loadDict(opts.wordsPath);
|
||||
@Test
|
||||
void testExtractSlots() {
|
||||
|
||||
@@ -44,8 +43,8 @@ public class MainTest {
|
||||
val key = Slot.packSlotKey(OFF_0_0, CLUE_RIGHT);
|
||||
clues.setClue(OFF_0_0, CLUE_RIGHT);
|
||||
var grid = new Gridded(clues.toGrid());
|
||||
|
||||
placeWord(grid.grid(), key, (1L << OFF_0_1) | (1L << OFF_0_2), 0, AB);
|
||||
val g = grid.grid().g;
|
||||
placeWord(grid.grid(), g, key, (1L << OFF_0_1) | (1L << OFF_0_2), 0, AB);
|
||||
|
||||
var slots = extractSlots(clues, dict.index());
|
||||
assertEquals(1, slots.length);
|
||||
@@ -95,7 +94,7 @@ public class MainTest {
|
||||
var grid = new Gridded(clues.toGrid());
|
||||
|
||||
// Test set/get
|
||||
placeWord(grid.grid(), 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));
|
||||
Assertions.assertEquals(LETTER_A, arr.get(OFF_1_1));
|
||||
Assertions.assertEquals(LETTER_Z, arr.get(OFF_0_1));
|
||||
@@ -193,6 +192,8 @@ public class MainTest {
|
||||
System.out.println("[DEBUG_LOG] ClueMap Size: " + res.filled().wordCount());
|
||||
System.out.println("[DEBUG_LOG] Grid:");
|
||||
System.out.println(res.filled().grid().renderHuman(res.clues().mask()));
|
||||
System.out.println(res.filled().grid().gridToString(res.clues().mask()));
|
||||
System.out.println(res.filled().grid().renderHuman(res.clues().mask()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user