: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

@@ -5,6 +5,8 @@ export type Snake = Uint8Array & { _tag: "__Snake__" };
export const getHeadX = (snake: Snake) => snake[0] - 2;
export const getHeadY = (snake: Snake) => snake[1] - 2;
export const getSnakeLength = (snake: Snake) => snake.length / 2;
export const copySnake = (snake: Snake) => snake.slice() as Snake;
export const snakeEquals = (a: Snake, b: Snake) => {