Synthetic Labyrinths

A self-evolving maze system where algorithmic patterns create intricate pathways influenced by user interaction. Explore the fractal complexity of procedural architecture.

Generative Algorithm

This labyrinth uses recursive backtracking algorithms to generate solvable mazes. The system combines cellular automata rules with reinforcement learning to create organic path structures that adapt to user interactions.

Maze Generation:

function carvePath(x, y) {
    directions[Math.random() * directions.length] | 0;
    
    while (hasUnvisitedNeighbors(x, y)) {
        const [nx, ny] = nextUnvisitedNeighbor(x, y);
        breakWall(x, y, nx, ny);
        carvePath(nx, ny);
    }
}

Interaction Layer:

canvas.addEventListener('mousemove', e => {
    const pos = getMazeCoordinates(e);
    if (random(0,1) < 0.05) {
        addMazeTwist(pos.x, pos.y);
        regeneratePath();
    }
});

Control the Maze Evolution

🖱
Drag Movement

Adds randomized walls and creates new dead-ends in the structure

🔁
Double Click

Triggers recursive regeneration of the entire maze pattern

Spacebar

Resets to a simple perfect maze with one solution path