🌀 MAZE RUNNER

A brand-new maze every game — find the ring in the far corner

← Back to Fun Time
Steps
0
Best possible
0
Time
0
Escaped
0

⌨️ Controls

  • or W A S D walk
  • Tapping the maze walks one step towards where you tapped
  • H or SPACE show the shortest way out
  • N dig a brand-new maze  •  P pause
  • 🎮 Xbox controller? Just plug it in or pair it — the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

🎯 How to play

  • Start in the top-left corner. The ring in the bottom-right is the way out.
  • Every maze is dug fresh, so you have never seen this one before.
  • There is always exactly one route between any two places — no loops.
  • The scoreboard shows the fewest steps possible. Can you match it?

🧠 Two great algorithms

  • The maze is dug by a recursive backtracker: walk, dig, and back up when stuck.
  • The hint uses breadth-first search, the shortest-path algorithm.
  • The same search finds routes on road maps and in chess programs.
  • Both are only about twenty lines. You write them in the workshop.

🧑‍💻 For young coders: build this game yourself

This 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.