From f5c151b9379f10fbf6c13bf40d645fe6999f894f Mon Sep 17 00:00:00 2001 From: elioat Date: Fri, 7 Jun 2024 21:25:23 -0400 Subject: * --- ts/bun/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ts') diff --git a/ts/bun/index.ts b/ts/bun/index.ts index 0a0f217..2b63565 100644 --- a/ts/bun/index.ts +++ b/ts/bun/index.ts @@ -26,7 +26,7 @@ export function step(grid: Grid): Grid { return grid.map((row, x) => row.map((cell, y) => { const neighbors = countNeighbors(grid, x, y); - return neighbors === 3 || (neighbors === 2 && cell); + return neighbors === 3 || (neighbors === 2 && cell) ? 1 : 0; }) ); } @@ -67,6 +67,11 @@ const toad: Grid = [ [0, 0, 0, 0, 0, 0] ]; +console.log('Initial:'); simulate(initial, 5); + +console.log('Flyer:'); simulate(flyer, 5); + +console.log('Toad:'); simulate(toad, 5); -- cgit 1.4.1-2-gfad0