Terminate upon icecap formation
This commit is contained in:
parent
1ba4397315
commit
1600a89643
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue