diff options
author | elioat <elioat@tilde.institute> | 2024-06-07 19:11:41 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-06-07 19:11:41 -0400 |
commit | 8c17222a7edf55896773335eea18c6f89e0ca923 (patch) | |
tree | 4664b7f696e811314a5c8e6b4e6ae3503ebb116a /ts | |
parent | a860fa1fc561209ee7924746e0dc0f425227c43c (diff) | |
download | tour-8c17222a7edf55896773335eea18c6f89e0ca923.tar.gz |
*
Diffstat (limited to 'ts')
-rw-r--r-- | ts/bun/index.ts | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/ts/bun/index.ts b/ts/bun/index.ts index bcde236..0a0f217 100644 --- a/ts/bun/index.ts +++ b/ts/bun/index.ts @@ -1,4 +1,4 @@ -type Grid = boolean[][]; +type Grid = number[][]; export function printGrid(grid: Grid): void { grid.forEach(row => console.log(row.map(cell => cell ? '1' : '0').join(' '))); @@ -40,34 +40,33 @@ export function simulate(initial: Grid, steps: number): void { } const initial: Grid = [ - [false, true, false], - [false, true, false], - [false, true, false] + [0, 1, 0], + [0, 1, 0], + [0, 1, 0] ]; const flyer: Grid = [ - [false, false, false, false, false, false], - [false, false, false, false, false, false], - [false, false, false, false, false, false], - [false, false, false, true, false, false], - [false, false, false, false, true, false], - [false, false, true, true, true, false], - [false, false, false, false, false, false], - [false, false, false, false, false, false], - [false, false, false, false, false, false] + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0], + [0, 0, 0, 0, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0] ]; const toad: Grid = [ - [false, false, false, false, false, false], - [false, false, false, false, false, false], - [false, false, false, true, false, false], - [false, true, false, false, true, false], - [false, true, false, false, true, false], - [false, false, true, false, false, false], - [false, false, false, false, false, false] + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0], + [0, 1, 0, 0, 1, 0], + [0, 1, 0, 0, 1, 0], + [0, 0, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0] ]; - simulate(initial, 5); simulate(flyer, 5); -simulate(toad, 5); \ No newline at end of file +simulate(toad, 5); |