introduce bitloops

This commit is contained in:
mike
2026-01-20 07:08:31 +01:00
parent 47ead135d3
commit a764f45041
83 changed files with 205106 additions and 175 deletions

View File

@@ -5,9 +5,8 @@ import lombok.val;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import puzzle.Export.Clued;
import puzzle.Export.Dicts;
import puzzle.Export.Gridded;
import puzzle.Export.IntListDTO;
import puzzle.DictJavaGeneratorMulti.DictEntryDTO.IntListDTO;
import puzzle.Export.LetterVisit.LetterAt;
import puzzle.Masker.Clues;
import puzzle.Masker.Slot;
@@ -245,7 +244,7 @@ public class SwedishGeneratorTest {
assertEquals(LETTER_A, Lemma.byteAt(INERENAE, 6));
assertEquals(LETTER_E, Lemma.byteAt(INERENAE, 7));
var dict = Dicts.makeDict(new long[]{ APPLE, EXE, IN, INER, INEREN, INERENA, INERENAE });
var dict = DictJavaGeneratorMulti.Dicts.makeDict(new long[]{ APPLE, EXE, IN, INER, INEREN, INERENA, INERENAE });
assertEquals(1, dict.index()[3].words().length);
assertEquals(1, dict.index()[5].words().length);
@@ -301,7 +300,7 @@ public class SwedishGeneratorTest {
@Test
void testCandidateInfoForPattern() {
var dict = Dicts.makeDict(WORDS2);
var dict = DictJavaGeneratorMulti.Dicts.makeDict(WORDS2);
// Pattern "APP--" for length 5
var info = candidateInfoForPattern(Context.get().bitset(), packPattern("APP"), dict.index()[5].posBitsets(), dict.index()[5].numlong());
@@ -315,7 +314,7 @@ public class SwedishGeneratorTest {
// This should detect a slot starting at 0,1 with length 2 (0,1 and 0,2)
var clues = Masker.Clues.createEmpty();
clues.setClueLo(IDX_0_0.lo, CLUE_RIGHT);
var dict = Dicts.makeDict(WORDS2);
var dict = DictJavaGeneratorMulti.Dicts.makeDict(WORDS2);
var slots = Masker.extractSlots(clues, dict.index());
assertEquals(1, slots.length);
var s = slots[0];
@@ -437,7 +436,7 @@ public class SwedishGeneratorTest {
val counts = new byte[SIZE];
counts[1] = 2;
counts[2] = 3;
var dict = Dicts.makeDict(WORDS);
var dict = DictJavaGeneratorMulti.Dicts.makeDict(WORDS);
var entry5 = dict.index()[5];
// cross = (counts[1]-1) + (counts[2]-1) = 1 + 2 = 3
// score = 3 * 10 + len(2) = 32