Gather data

This commit is contained in:
mike
2026-01-08 22:54:14 +01:00
parent df73dbf844
commit 5b470239f5
7 changed files with 6 additions and 740 deletions

View File

@@ -54,7 +54,7 @@ public record ExportFormat() {
puz.swe().forEachSlot(g, (int key, long rs, long cs, int len) -> {
var word = clueMap.get(key);
if (word != null) {
var p = extractPlacedFromSlot(new Slot(key, rs, cs, len), word);
var p = extractPlacedFromSlot(Slot.from(key, rs, cs, len), word);
if (p != null) placed.add(p);
}
});

View File

@@ -328,8 +328,11 @@ public record SwedishGenerator(int[] buff) {
return new CandidateInfo(cur, curLen);
}
static record Slot(int key, long rs, long cs, int len) {
//perhaps just put len into key and use hash-code and derrive index from key. or just put both ints into tail of the two longs.
static Slot from(int key, long rs, long cs, int len) {
/* if ((Long.highestOneBit(rs | cs) >> 2) != (len - 1)) throw new RuntimeException();
if ((Long.highestOneBit(cs) >> 2) != (len - 1)) throw new RuntimeException();
if ((Long.highestOneBit(rs) >> 2) != (len - 1)) throw new RuntimeException();*/
return new Slot(key, rs, cs, len);
}
@@ -385,7 +388,7 @@ public record SwedishGenerator(int[] buff) {
ArrayList<Slot> extractSlots(Grid grid) {
var slots = new ArrayList<Slot>(64);
forEachSlot(grid, (key, rs, cs, len) -> slots.add(new Slot(key, rs, cs, len)));
forEachSlot(grid, (key, rs, cs, len) -> slots.add(Slot.from(key, rs, cs, len)));
return slots;
}