Gather data
This commit is contained in:
@@ -39,7 +39,7 @@ public final class ExportFormat {
|
||||
var word = clueMap.get(s.key());
|
||||
if (word == null) continue;
|
||||
|
||||
var p = extractPlacedFromSlot(s, word);
|
||||
var p = extractPlacedFromSlot(puz.dict(),s, word);
|
||||
if (p == null) continue;
|
||||
placed.add(p);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public final class ExportFormat {
|
||||
/**
|
||||
* Convert a generator Slot + assigned word into a Placed object for export.
|
||||
*/
|
||||
private static Placed extractPlacedFromSlot(Slot s, String word) {
|
||||
private static Placed extractPlacedFromSlot(Dict dict,Slot s, String word) {
|
||||
int r = s.clueR();
|
||||
int c = s.clueC();
|
||||
char d = s.dir();
|
||||
@@ -168,7 +168,7 @@ public final class ExportFormat {
|
||||
|
||||
return new Placed(
|
||||
word,
|
||||
word, // clue placeholder
|
||||
dict.words().get(word).clue(), // clue placeholder
|
||||
startRow,
|
||||
startCol,
|
||||
direction,
|
||||
@@ -182,14 +182,9 @@ public final class ExportFormat {
|
||||
}
|
||||
|
||||
// pack (r,c) into one long key (handles negatives too)
|
||||
private static long pack(int r, int c) {
|
||||
return (((long) r) << 32) ^ (c & 0xFFFFFFFFL);
|
||||
}
|
||||
|
||||
// ---------- Data models ----------
|
||||
|
||||
private static long pack(int r, int c) { return (((long) r) << 32) ^ (c & 0xFFFFFFFFL); }
|
||||
/**
|
||||
* @param direction "horizontal" | "vertical"
|
||||
* @param direction "h" | "v"
|
||||
* @param cells word cells
|
||||
* @param arrow [arrowRow, arrowCol] */
|
||||
private record Placed(String word, String clue, int startRow, int startCol, String direction, String answer, int arrowRow, int arrowCol, List<int[]> cells, int[] arrow,
|
||||
@@ -197,8 +192,7 @@ public final class ExportFormat {
|
||||
|
||||
public record Rewards(int coins, int stars, int hints) { }
|
||||
|
||||
/**
|
||||
* @param direction "horizontal" | "vertical" */
|
||||
/// @param direction "h" | "v"
|
||||
public record WordOut(String word, String clue, int startRow, int startCol, String direction, String answer, int arrowRow, int arrowCol, boolean isReversed, int complex) { }
|
||||
|
||||
public record ExportedPuzzle(List<String> gridv2, List<WordOut> words, int difficulty, Rewards rewards) { }
|
||||
|
||||
Reference in New Issue
Block a user