A brand-new maze every game — find the ring in the far corner
← Back to Fun TimeThis game is split into small library files inside funtime/lib/, and every function has a comment saying exactly what goes in, what comes out, and the algorithm in plain English. Empty any function out, read its comment, and write it yourself.
| File | What it does | Good functions to try re-writing |
|---|---|---|
| lib/maze-rules.js | The rules: digging the maze and finding the way out | roomNeighbours, carveMaze, findPath, movePlayer |
| lib/maze-draw.js | Painting the rock, the corridors and the hint | drawMaze, drawHint, renderGame |
| lib/maze-main.js | The glue: the keyboard, the taps, the clock | doAction, connectBoard, gameLoop |
💡 The big idea: a stack and a queue are the same shape with one difference — which end you take from — and that one difference changes everything. Take from the back and you wander deep into a maze, which is perfect for digging one. Take from the front and you spread out evenly, which finds the shortest way through.
🛠️ Want to be walked through it? Build Maze Runner Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.