introduce bitloops
This commit is contained in:
@@ -14,6 +14,25 @@ import puzzle.Masker.Slot;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static precomp.Const9x8.*;
|
||||
import static precomp.Const9x8.Cell.*;
|
||||
import static puzzle.LemmaData.ABC;
|
||||
import static puzzle.LemmaData.ABD;
|
||||
import static puzzle.LemmaData.APPLE;
|
||||
import static puzzle.LemmaData.APPLY;
|
||||
import static puzzle.LemmaData.AT;
|
||||
import static puzzle.LemmaData.AZ;
|
||||
import static puzzle.LemmaData.BANAN;
|
||||
import static puzzle.LemmaData.BANANA;
|
||||
import static puzzle.LemmaData.BANANAS;
|
||||
import static puzzle.LemmaData.BANANASS;
|
||||
import static puzzle.LemmaData.CAT;
|
||||
import static puzzle.LemmaData.DOGS;
|
||||
import static puzzle.LemmaData.EXE;
|
||||
import static puzzle.LemmaData.IN;
|
||||
import static puzzle.LemmaData.INE;
|
||||
import static puzzle.LemmaData.INER;
|
||||
import static puzzle.LemmaData.INEREN;
|
||||
import static puzzle.LemmaData.INERENA;
|
||||
import static puzzle.LemmaData.INERENAE;
|
||||
import static puzzle.SwedishGenerator.*;
|
||||
|
||||
public class SwedishGeneratorTest {
|
||||
@@ -27,35 +46,23 @@ public class SwedishGeneratorTest {
|
||||
public static Context get() { return CTX.get(); }
|
||||
}
|
||||
|
||||
static final long TEST = Lemma.from("TEST");
|
||||
static final long IN = Lemma.from("IN");
|
||||
static final long INER = Lemma.from("INER");
|
||||
static final long INEREN = Lemma.from("INEREN");
|
||||
static final long INERENA = Lemma.from("INERENA");
|
||||
static final long INERENAE = Lemma.from("INERENAE");
|
||||
static final long APPLE = Lemma.from("APPLE");
|
||||
static final long EXE = Lemma.from("AXE");
|
||||
static final long ABC = Lemma.from("ABC");
|
||||
static final long ABD = Lemma.from("ABD");
|
||||
static final long AZ = Lemma.from("AZ");
|
||||
static final long AB = Lemma.from("AB");
|
||||
static final long[] WORDS = new long[]{
|
||||
Lemma.from("AT"),
|
||||
Lemma.from("CAT"),
|
||||
Lemma.from("DOGS"),
|
||||
static final long[] WORDS = new long[]{
|
||||
AT,
|
||||
CAT,
|
||||
DOGS,
|
||||
APPLE,
|
||||
Lemma.from("APPLY"),
|
||||
Lemma.from("BANAN"),
|
||||
Lemma.from("BANANA"),
|
||||
Lemma.from("BANANAS"),
|
||||
Lemma.from("BANANASS") // length 8
|
||||
APPLY,
|
||||
BANAN,
|
||||
BANANA,
|
||||
BANANAS,
|
||||
BANANASS
|
||||
};
|
||||
|
||||
static final long[] WORDS2 = new long[]{ IN,
|
||||
APPLE,
|
||||
Lemma.from("APPLY"),
|
||||
Lemma.from("BANAN"),
|
||||
Lemma.from("INE"),
|
||||
APPLY,
|
||||
BANAN,
|
||||
INE,
|
||||
INER,
|
||||
INEREN,
|
||||
INERENA,
|
||||
@@ -77,12 +84,10 @@ public class SwedishGeneratorTest {
|
||||
static final byte CLUE_UP = 2;
|
||||
static final byte CLUE_LEFT = 3;
|
||||
|
||||
static final byte D_BYTE_2 = CLUE_RIGHT;
|
||||
|
||||
@Test
|
||||
void testPatternForSlotAllLetters() {
|
||||
var key = r0c0d1.slotKey;
|
||||
val clues = Clues.of(r0c0d1);
|
||||
val clues = Clued.of(r0c0d1);
|
||||
var grid = new Gridded(clues);
|
||||
GridBuilder.placeWord(grid.grid(), grid.grid().g, key, (1L << OFF_0_1) | (1L << OFF_0_2) | (1L << OFF_0_3), 0L, ABC);
|
||||
val map = grid.stream(clues).collect(Collectors.toMap(LetterAt::index, LetterAt::letter));
|
||||
@@ -246,7 +251,7 @@ public class SwedishGeneratorTest {
|
||||
@Test
|
||||
void testForEachSlotAndExtractSlots() {
|
||||
// This should detect a slot starting at 0,1 with length 2 (0,1 and 0,2)
|
||||
var clues = Clues.of(r0c0d1);
|
||||
var clues = Clued.of(r0c0d1);
|
||||
var dict = DictJavaGeneratorMulti.Dicts.makeDict(WORDS2);
|
||||
var slots = Masker.extractSlots(clues, dict.index());
|
||||
assertEquals(1, slots.length);
|
||||
|
||||
Reference in New Issue
Block a user