Make single cell clusters wider

This commit is contained in:
Rike-Benjamin Schuppner 2024-07-25 11:56:18 +02:00
parent cc4e71e1a9
commit 6f3e459e6e

View file

@ -171,6 +171,24 @@ const createPath = (cluster: Pos[]) => {
} }
}; };
if (cluster.length === 1) {
// Widen the dot so that it does not look like food
const [x, y] = cluster[0];
const px = x * cellSize + 0.5 * cellSize;
const py = y * cellSize + offset;
return [
`M ${px},${py}`,
`l ${-offset} 0`,
`a 1,1 0 0 0 0,${cellSize - 2*offset}`,
`l ${2 * offset} 0`,
`a 1,1 0 0 0 0,${- cellSize + 2*offset}`,
`Z`
].join(" ");
}
const pathCommands = cluster.flatMap((startCell) => { const pathCommands = cluster.flatMap((startCell) => {
// iterate through all possible starting points in all cells (unless already visited) // iterate through all possible starting points in all cells (unless already visited)
const paths = [0, 1, 2, 3].map(startRefPoint => { const paths = [0, 1, 2, 3].map(startRefPoint => {