From 44c8c917f84a44eeb70aa6e2b598d9af52b6d765 Mon Sep 17 00:00:00 2001 From: elioat <{ID}+{username}@users.noreply.github.com> Date: Fri, 21 Jun 2024 08:18:00 -0400 Subject: * --- ts/bun/life.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ts/bun/life.ts') diff --git a/ts/bun/life.ts b/ts/bun/life.ts index 965e422..bd36c27 100644 --- a/ts/bun/life.ts +++ b/ts/bun/life.ts @@ -1,9 +1,6 @@ export type Grid = number[][]; -export function printGrid(grid: Grid): void { - grid.forEach(row => console.log(row.map(cell => cell ? '🟢' : '⚪️').join(''))); - console.log('\n'); -} +// FIXME: I'm exporting way more than is necessary to support testing. What if I didn't do that? export function countNeighbors(grid: Grid, x: number, y: number): number { const neighborOffsets = [ @@ -31,6 +28,11 @@ export function step(grid: Grid): Grid { ); } +export function printGrid(grid: Grid): void { + grid.forEach(row => console.log(row.map(cell => cell ? '🟢' : '⚪️').join(''))); + console.log('\n'); +} + export function simulate(initial: Grid, steps: number): void { let grid = initial; Array.from({ length: steps }).forEach(() => { -- cgit 1.4.1-2-gfad0