introduce bitloops
This commit is contained in:
@@ -159,15 +159,17 @@ public record Export() {
|
||||
public void clear() { Arrays.fill(bits, 0L); }
|
||||
}
|
||||
|
||||
record Placed(long lemma, char direction, int slotKey, int[] cells) {
|
||||
record Placed(long lemma, int slotKey, int[] cells) {
|
||||
|
||||
public static final char HORIZONTAL = 'h';
|
||||
static final char VERTICAL = 'v';
|
||||
static final char[] DIRECTION = { '\0', Placed.VERTICAL, Placed.HORIZONTAL, Placed.VERTICAL, Placed.HORIZONTAL, Placed.VERTICAL };
|
||||
public static final char HORIZONTAL = 'h';
|
||||
static final char VERTICAL = 'v';
|
||||
public int arrowCol() { return Grid.c(Slot.clueIndex(slotKey)); }
|
||||
public int arrowRow() { return Grid.r(Slot.clueIndex(slotKey)); }
|
||||
public int startRow() { return Grid.r(cells[0]); }
|
||||
public int startCol() { return Grid.c(cells[0]); }
|
||||
public boolean isReversed() { return !Slot.increasing(slotKey); }
|
||||
public char direction() { return DIRECTION[Slot.dir(slotKey)]; }
|
||||
}
|
||||
|
||||
public record Rewards(int coins, int stars, int hints) { }
|
||||
@@ -185,15 +187,11 @@ public record Export() {
|
||||
|
||||
boolean inBounds(int idx) { return idx >= 0 && idx < SwedishGenerator.SIZE; }
|
||||
Placed extractPlacedFromSlot(Slot s, long lemma) {
|
||||
var d = s.dir();
|
||||
|
||||
var cells = s.walk().toArray();
|
||||
|
||||
char[] DIRECTION = { '\0', Placed.VERTICAL, Placed.HORIZONTAL, Placed.VERTICAL, Placed.HORIZONTAL, Placed.VERTICAL };
|
||||
|
||||
return new Placed(
|
||||
lemma,
|
||||
DIRECTION[d],
|
||||
s.key(),
|
||||
cells
|
||||
);
|
||||
@@ -258,7 +256,7 @@ public record Export() {
|
||||
p.lemma,
|
||||
p.startRow() - MIN_R,
|
||||
p.startCol() - MIN_C,
|
||||
p.direction,
|
||||
p.direction(),
|
||||
p.arrowRow() - MIN_R,
|
||||
p.arrowCol() - MIN_C,
|
||||
p.isReversed()
|
||||
|
||||
Reference in New Issue
Block a user