introduce bitloops
This commit is contained in:
@@ -6,7 +6,6 @@ import lombok.experimental.Delegate;
|
|||||||
import lombok.val;
|
import lombok.val;
|
||||||
import precomp.Const9x8.Cell;
|
import precomp.Const9x8.Cell;
|
||||||
import puzzle.Export.Gridded.Replacar.Rell;
|
import puzzle.Export.Gridded.Replacar.Rell;
|
||||||
import puzzle.Export.LetterVisit.LetterAt;
|
|
||||||
import puzzle.Masker.Clues;
|
import puzzle.Masker.Clues;
|
||||||
import puzzle.SwedishGenerator.Dict;
|
import puzzle.SwedishGenerator.Dict;
|
||||||
import puzzle.SwedishGenerator.FillResult;
|
import puzzle.SwedishGenerator.FillResult;
|
||||||
@@ -110,19 +109,6 @@ public record Export() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LetterVisit {
|
|
||||||
|
|
||||||
record LetterAt(int index, byte letter) {
|
|
||||||
|
|
||||||
public int row() { return INDEX_ROW(index); }
|
|
||||||
public int col() { return INDEX_COL(index); }
|
|
||||||
public char human() { return LETTER(letter); }
|
|
||||||
static LetterAt from(int index, byte[] bytes) { return new LetterAt(index, bytes[index]); }
|
|
||||||
public int index(int cols) { return (row() * cols) + col(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
record Gridded(@Delegate Grid grid, Clues cl)
|
record Gridded(@Delegate Grid grid, Clues cl)
|
||||||
implements Stream<LetterAt> {
|
implements Stream<LetterAt> {
|
||||||
|
|
||||||
@@ -301,4 +287,12 @@ public record Export() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record LetterAt(int index, byte letter) {
|
||||||
|
|
||||||
|
public int row() { return INDEX_ROW(index); }
|
||||||
|
public int col() { return INDEX_COL(index); }
|
||||||
|
public char human() { return LETTER(letter); }
|
||||||
|
static LetterAt from(int index, byte[] bytes) { return new LetterAt(index, bytes[index]); }
|
||||||
|
public int index(int cols) { return (row() * cols) + col(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import static puzzle.SwedishGenerator.*;
|
|||||||
public final class Masker {
|
public final class Masker {
|
||||||
|
|
||||||
public static final rci[] IT = Neighbors9x8.IT;
|
public static final rci[] IT = Neighbors9x8.IT;
|
||||||
public static final long[] PATH_LO = Neighbors9x8.PATH_LO;
|
public static final long[] PATH_LO = Neighbors9x8.PATH_LO;
|
||||||
public static final long[] PATH_HI = Neighbors9x8.PATH_HI;
|
public static final long[] PATH_HI = Neighbors9x8.PATH_HI;
|
||||||
public static final long MASK_LO = -1L;
|
public static final long MASK_LO = -1L;
|
||||||
public static final long MASK_HI = Neighbors9x8.MASK_HI;//(1L << (SIZE - 64)) - 1;
|
public static final long MASK_HI = Neighbors9x8.MASK_HI;//(1L << (SIZE - 64)) - 1;
|
||||||
private final Rng rng;
|
private final Rng rng;
|
||||||
private final int[] stack;
|
private final int[] stack;
|
||||||
private final Clues cache;
|
private final Clues cache;
|
||||||
@@ -650,7 +650,7 @@ public final class Masker {
|
|||||||
//@formatter:on
|
//@formatter:on
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Accessors(fluent = true)
|
@Accessors(fluent = true)
|
||||||
public static final class Clues {
|
public static final class Clues {
|
||||||
|
|
||||||
@Getter long lo, hi, vlo, vhi, rlo, rhi, xlo, xhi;
|
@Getter long lo, hi, vlo, vhi, rlo, rhi, xlo, xhi;
|
||||||
public static Clues createEmpty() { return new Clues(0, 0, 0, 0, 0, 0, 0, 0); }
|
public static Clues createEmpty() { return new Clues(0, 0, 0, 0, 0, 0, 0, 0); }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import precomp.Neighbors9x8.rci;
|
|||||||
import puzzle.Export.ClueAt;
|
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.LetterAt;
|
||||||
import puzzle.Export.PuzzleResult;
|
import puzzle.Export.PuzzleResult;
|
||||||
import puzzle.Export.Rewards;
|
import puzzle.Export.Rewards;
|
||||||
import puzzle.Main.Opts;
|
import puzzle.Main.Opts;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import precomp.Neighbors9x8.rci;
|
|||||||
import puzzle.DictJavaGeneratorMulti.DictEntryDTO.IntListDTO;
|
import puzzle.DictJavaGeneratorMulti.DictEntryDTO.IntListDTO;
|
||||||
import puzzle.Export.Clued;
|
import puzzle.Export.Clued;
|
||||||
import puzzle.Export.Gridded;
|
import puzzle.Export.Gridded;
|
||||||
import puzzle.Export.LetterVisit.LetterAt;
|
import puzzle.Export.LetterAt;
|
||||||
import puzzle.Masker.Clues;
|
import puzzle.Masker.Clues;
|
||||||
import puzzle.Masker.Slot;
|
import puzzle.Masker.Slot;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user