Maze
Controls
- Arrow keys or WASD — move through the maze.
- Reach the green square to win.
- Generate a new maze any time.
The Maze is one of humanity’s oldest puzzle formats — physical mazes (labyrinths) date back to ancient Egypt and Crete (the famous Labyrinth of Minos). As an interactive puzzle game, the Maze tests navigation, spatial reasoning, and patience. This game offers procedurally generated mazes that you traverse from start to finish — simple, meditative, and infinitely replayable.
How to play
- You’re placed at the start position of a maze.
- Arrow keys (or WASD, or swipe on a phone) — move one square at a time in any direction (north, south, east, west).
- Walls block movement.
- Start in the top-left corner (green) and reach the red goal in the bottom-right corner to solve the maze.
- Four sizes: Small (11×7 grid), Medium (21×15), Large (31×21) and Huge (41×29).
- Your steps and time are shown as you go and on the win screen.
- Stuck? Solve (show path) draws the shortest route from where you stand for three seconds.
Beginner strategy: the Right-hand Rule
- Always keep your right hand on the wall as you walk. Eventually you’ll reach the exit (or return to start).
- This works on simply connected mazes. Every maze in this game is one, so the rule always gets you to the goal.
- Not optimal but guaranteed. The right-hand rule may traverse the whole maze before finding the exit — long, but successful.
- Equivalent: left-hand rule. Same idea, opposite hand. Both work on standard mazes.
- Fails on multiply-connected mazes (mazes with loops). Most generated mazes are simply connected.
Intermediate strategy: dead-end elimination
- Identify dead ends. Cells with walls on 3 of 4 sides are dead ends.
- Mentally mark dead ends. Once entered, don’t revisit.
- Trace the “spine.” The path from start to end is the maze’s spine; everything else is dead-end branches.
- Backtrack efficiently. When you hit a dead end, retrace to the last decision point and try a different direction.
- Look ahead. Before committing to a corridor, glance further to see if it leads somewhere.
Advanced strategy: maze structure
- Tremaux’s algorithm. Trace paths and mark them. Avoid retracing fully-explored corridors. Always solves any maze efficiently.
- Random mouse algorithm. Random walks eventually solve any connected maze, but they can take a very long time. Inefficient.
- Pledge algorithm. Escapes mazes with loops by wall-following while keeping a running count of the turns you make.
- BFS for optimal pathing. Breadth-first search finds the shortest path. It’s what the Solve button uses to draw your route.
- Speed solving. On the bigger sizes, scan ahead from the goal as well as from your position; the two searches meet in the middle.
Maze types
- Simply connected: no loops; right-hand rule solves them.
- Multiply connected: has loops; right-hand rule may fail.
- Weave maze: corridors can pass over and under each other (3D-like).
- Spiral maze: corridors spiral inward.
- Theta maze: circular concentric rings.
- Hexagonal maze: hex cells with up to 6 walls each.
Maze generation algorithms
- Recursive backtracking. Carves paths through walls using DFS. Creates long, winding corridors with relatively few dead ends. This game uses it.
- Prim’s algorithm. Grows the maze outward from a random frontier. Creates lots of short dead ends.
- Kruskal’s algorithm. Union-find based. Also tends to produce many short dead ends.
- Wilson’s algorithm. Loop-erased random walk. Picks uniformly among all possible perfect mazes, with no bias.
- Recursive division. Splits the space with walls, leaving a gap in each, then repeats inside each region.
Maze history
- Ancient Egypt: labyrinth at the Hawara pyramid complex of Amenemhat III, ~1800s BC.
- Crete (1700 BC): the legendary Labyrinth of Minos. Greek myth.
- Medieval Europe: cathedral floor labyrinths for spiritual contemplation.
- 17th century — hedge mazes: ornamental garden mazes in England, like Hampton Court Palace’s 1690 maze.
- 1973 — Maze War: one of the first maze video games. 1980 — Pac-Man turned the maze chase into an arcade hit.
- Modern era: mazes in countless video games, puzzle books, and AI research benchmarks.
Common mistakes
- Wandering without strategy. Random movement is slow and frustrating.
- Not marking dead ends. Re-exploring dead ends wastes huge time.
- Ignoring the right-hand rule. Simple, and guaranteed to work on every maze here.
- Rushing through corridors without looking. Always glance ahead.
Variants
- 3D mazes. Multiple floors with stairs.
- Themed mazes. Pac-Man, Zelda dungeons.
- Logic mazes. Where wall colors affect navigation rules.
- Time-limit mazes. Race against the clock.
- AI maze solvers. Standard introductory CS exercise.
FAQ
- Q: Does the right-hand rule always work? A: On simply connected mazes, yes. Not on mazes with loops.
- Q: Is there an optimal solution? A: For every maze, yes — the shortest path. Finding it requires graph search.
- Q: What’s the fastest solving approach? A: Tremaux’s algorithm — path marking + backtracking — guarantees a solution and walks each passage at most twice.
- Q: Are all mazes solvable? A: Yes — if a maze has a connected start and end, a path always exists. Every maze here is a perfect maze with exactly one route between start and goal.
For other navigation/puzzle games, try Sokoban, 15 Puzzle, Pacman, or Tower of Hanoi.
Guides and tips
- Best Browser Maze Games to Play Free OnlineThe best maze games to play free in your browser, from fresh generated mazes and Pac-Man…
- 10 Games Like Zelda You Can Play in Your BrowserThe best games like Zelda you can play free in a browser, from Champion Island and…
- 10 Browser Games for Stroke Recovery PracticeCalm browser games stroke recovery patients may enjoy between sessions: word, puzzle, memory and card games…





