feat: allow flexible clue placement in all four directions for puzzles
Co-authored-by: aider (gpt-4o) <aider@aider.chat>
This commit is contained in:
@@ -326,8 +326,9 @@ public class SwedishGenerator {
|
|||||||
var d = grid[r][c];
|
var d = grid[r][c];
|
||||||
if (!isDigit(d)) continue;
|
if (!isDigit(d)) continue;
|
||||||
|
|
||||||
var di = d - '0';
|
// Check all four possible directions for clue placement
|
||||||
int dr = DIRS[di][0], dc = DIRS[di][1];
|
for (int dir = 1; dir <= 4; dir++) {
|
||||||
|
int dr = DIRS[dir][0], dc = DIRS[dir][1];
|
||||||
|
|
||||||
int rr = r + dr, cc = c + dc;
|
int rr = r + dr, cc = c + dc;
|
||||||
if (rr < 0 || rr >= H || cc < 0 || cc >= W) continue;
|
if (rr < 0 || rr >= H || cc < 0 || cc >= W) continue;
|
||||||
@@ -348,7 +349,8 @@ public class SwedishGenerator {
|
|||||||
if (n > MAX_LEN) break; // allow n==MAX_LEN+1
|
if (n > MAX_LEN) break; // allow n==MAX_LEN+1
|
||||||
}
|
}
|
||||||
|
|
||||||
slots.add(new Slot(r, c, d, Arrays.copyOf(rs, n), Arrays.copyOf(cs, n)));
|
slots.add(new Slot(r, c, (char) ('0' + dir), Arrays.copyOf(rs, n), Arrays.copyOf(cs, n)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return slots;
|
return slots;
|
||||||
|
|||||||
Reference in New Issue
Block a user