Hic sunt dracones.
Four walkers, no compass, one rule: never step where someone has stepped before. The borders draw themselves.
The walker
javascript·chartis.js
function* walker() {
const stack = [{ x: random(width), y: random(height), heading: random(TAU) }];
while (stack.length) {
let { x, y, heading } = stack.pop();
const forks = random() < 0.025 ? 2 : 1;
for (let i = 0; i < forks; i++, heading += HALF_PI) {
let nx = x, ny = y;
do {
const n = noise(nx / width, ny / height) * 5;
nx = (nx + cos(heading + n) + width) % width;
ny = (ny + sin(heading + n) + height) % height;
} while (floor(nx) === floor(x) && floor(ny) === floor(y));
if (world.taken(nx, ny)) continue;
stack.push({ x: nx, y: ny, heading });
world.claim(nx, ny);
yield;
}
}
}
References
- Adapted from a p5.js map generator built on generator functions, given rival walkers and this site’s ink.
- Here be dragons