A labyrinth in negatively curved space: the world glides past while you stay at the center.
The rooms are the heptagons of the {7,3} tiling, three to a corner, which only fits in the hyperbolic plane; the Poincare disk shows it with rooms shrinking toward the rim, and the number of rooms within n steps grows exponentially. Each room is a 3x3 Lorentz matrix on the hyperboloid model, generated breadth-first by rotating and boosting across each edge and deduplicated by where its center lands, and a randomized depth-first spanning tree over that adjacency graph carves the maze, with extra rings of rock so the tiling never runs out. Walking from room to room glides a Lorentz camera matrix along the geodesic between the two centers, an exact isometry of the disk, so you always stay in the middle; walls are drawn as true geodesic arcs and thin with the disk's conformal factor. The autopilot floods the maze breadth-first (the bright wavefront), then follows the shortest path to the glowing gate on the rim.
Try it. Use the arrow keys or WASD to step toward the room in that direction, or tap a room: a neighbor is one step, a farther room is walked to by the maze route. Drag to turn the disk, press R for a new maze, and go idle for a few seconds to let the autopilot take over.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a maze you walk through in the hyperbolic plane, with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens (scale by devicePixelRatio). Draw the Poincare disk as a big circle in the middle.
- Work in the hyperboloid model: a point is (x, y, t) with t^2 - x^2 - y^2 = 1, it maps into the disk as (x, y) / (1 + t), and isometries are 3x3 matrices. Write helpers for a rotation, a boost (a translation along the x axis by distance d, using cosh d and sinh d) and matrix multiply.
- Build the 7,3 tiling (seven-sided rooms, three around each corner): a heptagon has circumradius R with cosh R = cot(pi/7) cot(pi/3), and neighboring centers are 2a apart with cosh a = cos(pi/3) / sin(pi/7). Starting from one tile's matrix, make each neighbor as M * rotate(2 pi k / 7) * boost(2a) * rotate(pi), breadth-first out to about 5 rings, and skip duplicates by rounding the center coordinates into a key.
- Carve a maze with a randomized depth-first search over neighboring tiles and draw the closed edges as walls, thinner toward the rim.
Once that works, make it beautiful:
- Keep the player at the center: keep a camera matrix, and to walk to a neighbor, animate the camera with a boost along the direction of that room's center, so the whole world glides.
- Draw edges as geodesics by sampling points between the two corners on the hyperboloid and normalizing them.
- Color rooms by their breadth-first distance from you and add an autopilot that walks the shortest path to an exit on the rim.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a 5,4 or 8,3 tiling, an animated breadth-first wavefront, or tapping a room to walk there.