{/* Cells */}
{Array.from({ length: size }, (_, r) =>
Array.from({ length: size }, (_, c) => {
const val = grid[r][c];
const isGiven = given[r][c] !== null;
const err = errors.has(`${r},${c}`);
let bg = "#ffffff";
if (isGiven) bg = "#e5e7eb"; // gray for given cells
const bRight = c < size - 1 ? "1px solid #d1d5db" : "none";
const bBottom = r < size - 1 ? "1px solid #d1d5db" : "none";
return (
cycleCell(r, c)}
style={{
width: CELL, height: CELL,
backgroundColor: bg,
backgroundImage: err ? DIAGONAL_ERROR : undefined,
borderRight: bRight,
borderBottom: bBottom,
cursor: (isGiven || won) ? "default" : "pointer",
display: "flex",
alignItems: "center",
justifyContent: "center",
userSelect: "none",
transition: "background-color 0.1s",
}}
>
{val === "sun" && }
{val === "moon" && }
);
})
)}
{/* Horizontal constraint symbols: between (r,c) and (r,c+1) — on the vertical border */}
{Array.from({ length: size }, (_, r) =>
Array.from({ length: size - 1 }, (_, c) => {
const e = hEdges[r][c];
if (!e) return null;
return (
{e === "=" ? "=" : "×"}
);
})
)}
{/* Vertical constraint symbols: between (r,c) and (r+1,c) — on the horizontal border */}
{Array.from({ length: size - 1 }, (_, r) =>
Array.from({ length: size }, (_, c) => {
const e = vEdges[r][c];
if (!e) return null;
return (
{e === "=" ? "=" : "×"}
);
})
)}