Terminate upon icecap formation

This commit is contained in:
Tangent Wantwight 2024-01-12 23:30:18 -05:00
parent 1ba4397315
commit 1600a89643
1 changed files with 7 additions and 2 deletions

View File

@ -115,6 +115,8 @@ export function IslandApplet() {
const basePos = len >> 1;
const width = islands.width;
let timerId: number;
function drop(pos: number) {
const lowerNeighbors: number[] = [];
@ -149,7 +151,10 @@ export function IslandApplet() {
}
// flat, increase elevation
islands.data[pos]++;
const newValue = ++islands.data[pos];
if (newValue == 9) {
clearInterval(timerId);
}
}
function tick() {
@ -167,7 +172,7 @@ export function IslandApplet() {
tick();
setInterval(tick, 1000 / 10);
timerId = setInterval(tick, 1000 / 30);
return [canvas];
}