/** 네모네모 로직 small pictures for the rules and the 30-second cards (SVG, no image files). */ /** Run lengths of the '#' cells; an empty line is [0]. */ export function runsOf(line: string): number[] { const out = line.split(/[^#]+/).filter(Boolean).map((s) => s.length); return out.length ? out : [0]; } /** * A small puzzle: clues from `answer`, cells from `marks` ('#' filled, 'x' X, '.' empty; default = the answer). * `color` paints the filled cells (a solved picture). */ export function MiniNono({ answer, marks = answer, color, cell = 22 }: { answer: string[]; marks?: string[]; color?: string; cell?: number }) { const n = answer.length; const S = 20; const rows = answer.map(runsOf); const cols = Array.from({ length: n }, (_, c) => runsOf(answer.map((r) => r[c]).join(''))); const left = Math.max(...rows.map((r) => r.length)) * 12 + 6; const top = Math.max(...cols.map((c) => c.length)) * 13 + 4; const w = left + n * S; const h = top + n * S; return ( {cols.map((clue, c) => clue.map((x, j) => ( {x} )), )} {rows.map((clue, r) => clue.map((x, j) => ( {x} )), )} {marks.flatMap((row, r) => [...row].map((ch, c) => { const x = left + c * S; const y = top + r * S; return ( {ch === 'x' && } ); }), )} ); }