interface WinLine { start:{row:number,col:number}; end:{row:number,col:number}; } function Board({board,onCell,highlight,winLine,theme}:{board:string[][],onCell:(r:number,c:number)=>void,highlight:any,winLine:WinLine|null,theme:string}){ const cells = board.map((row,r)=> row.map((c,cidx)=>onCell(r,cidx)}/>) ); let line=null; if(winLine){ const ext=0.4; const startCenter={x:winLine.start.col+0.5,y:winLine.start.row+0.5}; const endCenter={x:winLine.end.col+0.5,y:winLine.end.row+0.5}; const dx=endCenter.x-startCenter.x; const dy=endCenter.y-startCenter.y; const len=Math.sqrt(dx*dx+dy*dy); const nx=dx/len;const ny=dy/len; const a={x:startCenter.x-nx*ext,y:startCenter.y-ny*ext}; const b={x:endCenter.x+nx*ext,y:endCenter.y+ny*ext}; const color='#333'; line= ; } return
{cells}{line}
; }