diff options
Diffstat (limited to 'ts/bun')
-rw-r--r-- | ts/bun/life.ts | 10 |
1 files changed, 6 insertions, 4 deletions
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(() => { |