:roclet: improve algorithm, add an intermediate phase to clean up residual cell from previous layer, before grabing the free ones

This commit is contained in:
platane
2020-10-26 00:18:50 +01:00
parent 69c3551cc5
commit a3f590a7d2
13 changed files with 565 additions and 21 deletions

View File

@@ -3,10 +3,11 @@ import { createCanvas } from "./canvas";
import { Color, copyGrid } from "@snk/types/grid";
import { grid, snake } from "./sample";
import { pruneLayer } from "@snk/compute/pruneLayer";
import { getSnakeLength } from "@snk/types/snake";
const colors = [1, 2, 3] as Color[];
const snakeN = snake.length / 2;
const snakeN = getSnakeLength(snake);
const layers = [{ grid, chunk: [] as { x: number; y: number }[] }];
let grid0 = copyGrid(grid);