diff --git a/island.ts b/island.ts index a15b2bb..5e13e86 100644 --- a/island.ts +++ b/island.ts @@ -1,9 +1,9 @@ import { canvas2d } from "./lib/html"; import { Prng, mulberry32 } from "./lib/prng"; -const BLOWUP = 4; -const WIDTH = 240; -const HEIGHT = 135; +const BLOWUP = 4 * 5; +const WIDTH = 240 / 5; +const HEIGHT = 135 / 5; type Lookup2d = (x: number, y: number) => number; function dim(width: number, height: number): Lookup2d { @@ -104,12 +104,14 @@ export function IslandApplet() { const islands = new IslandGrid(WIDTH, HEIGHT, 128); - function tick() { - const pos = islands.rng() % islands.data.length; + const basePos = islands.data.length >> 1; - islands - .floodSearch(pos, (tile) => tile > 0) - .forEach((pos) => islands.data[pos]++); + function tick() { + const islandTiles = islands.floodSearch(basePos, (tile) => tile > 0); + + const pos = islandTiles[islands.rng() % islandTiles.length]; + + islands.data[pos]++; renderIslands(islands, cx); }