diff options
author | elioat <elioat@tilde.institute> | 2024-06-07 21:25:23 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-06-07 21:25:23 -0400 |
commit | f5c151b9379f10fbf6c13bf40d645fe6999f894f (patch) | |
tree | 509de44f75d2198a9a4b9e5b3901d39399d35f38 | |
parent | 8c17222a7edf55896773335eea18c6f89e0ca923 (diff) | |
download | tour-f5c151b9379f10fbf6c13bf40d645fe6999f894f.tar.gz |
*
-rw-r--r-- | ts/bun/index.ts | 7 |
1 files changed, 6 insertions, 1 deletions
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); |