SWIsland Recursion Saga

Recursion & Backtracking — Maze Edition

...loading...

Press Build Maze to begin.

Canvas:

⚙️ Controls
ON = shuffle N/S/E/W → organic, unpredictable path
OFF = fixed N→S→E→W order → same path every time
Space also pauses / resumes.   View Solution and Solve Maze are enabled after the maze is built.
Reset keeps the same maze — use Build Maze for a brand-new one.
📊 Recursion Cost
✅ Tries (ADD) 0
↩️ Backtracks 0
📉 Backtrack ratio
Ratio = backtracks ÷ tries. For a perfect maze with N cells, the solver visits every dead-end branch before finding the unique solution.
🎨 Color Guide

Build phase

  • Floor — unvisited cell (light gray-blue)
  • Frontier — current DFS head (bright cyan)
  • Carved — passage opened (medium gray-blue)
  • Build backtrack — DFS returned here (dim)

Solve phase

  • Trying — on the active path stack (green)
  • Dead end — backtracked from (red flash)
  • Solution — winning path / View Solution (gold)

Always

  • S — start cell (top-left, forest green)
  • T — treasure cell (bottom-right, amber gold)
  • Walls — near-black lines between cells
📋 Recursion Log