Skip to content

Pathfinding Lab: 6 algorithms, interactive grid, mazes, live re-path (v5) - #1

Open
Sebby1770 wants to merge 1 commit into
mainfrom
feat/pathfinding-lab
Open

Pathfinding Lab: 6 algorithms, interactive grid, mazes, live re-path (v5)#1
Sebby1770 wants to merge 1 commit into
mainfrom
feat/pathfinding-lab

Conversation

@Sebby1770

Copy link
Copy Markdown
Owner

Summary

Turns Sort Lab into Algorithm Lab by adding a full pathfinding visualizer as a second mode, switchable via new topbar tabs. Pure vanilla JS, no build step — same philosophy as the rest of the app.

Pathfinding Lab

  • 6 algorithms: BFS, DFS, Dijkstra, A*, Greedy Best-First, Bidirectional BFS
  • Interactive grid editor — drag to draw walls or weighted terrain (cost ×5), erase, and drag the start/goal markers. After a run, the path re-solves live while you drag.
  • Maze & terrain generators — recursive-division maze (guaranteed solvable), random scatter walls, scattered weights
  • Diagonal movement option with octile heuristic and corner-cutting prevention
  • Algorithm profile panel — shortest-path guarantee, complexity, and weight-awareness badges
  • Live metrics — visited cells, path steps, path cost, compute time
  • Keyboard shortcuts scoped per mode (V/C/B/M in pathfinding; sorting keys no longer fire there)
  • 3 grid sizes, touch support, dark mode, offline PWA (SW cache bumped to v4)

Bug fix included

.workspace { display: grid } was overriding the UA [hidden] style, so hidden on a workspace didn't actually hide it. Added an explicit .workspace[hidden] { display: none }.

Verification (all in-browser)

  • 200/200 random recursive-division mazes solvable, with BFS, Dijkstra, A*, and Bidirectional BFS agreeing on shortest-path length in every one
  • Weight-awareness: Dijkstra routes around a weighted band (cost 16) where BFS ploughs through (cost 66)
  • Diagonal cost never exceeds orthogonal cost on the same board
  • Pointer interactions verified: wall stroke painting, toggle-erase, weight brush, start/goal dragging with live re-path
  • Sorting mode regression-checked (bars render, runs start/stop, metrics update)

🤖 Generated with Claude Code

…-path (v5)

Turns Sort Lab into Algorithm Lab with a second visualizer mode:

- BFS, DFS, Dijkstra, A*, Greedy Best-First, and Bidirectional BFS on an
  interactive grid with walls, weighted terrain (cost x5), and draggable
  start/goal markers that re-solve the path live after a run
- Recursive-division maze generator (odd-lattice walls, even-lattice gaps
  and endpoints, so every maze is guaranteed solvable), plus random
  scatter and weighted-terrain generators
- Optional diagonal movement with octile heuristic and no corner-cutting
- Per-algorithm profile panel (guarantee, complexity, weight-awareness)
  and live metrics (visited, steps, cost, compute time)
- Mode tabs with per-mode keyboard shortcuts; sorting shortcuts no longer
  fire in pathfinding mode
- Fix: workspaces with the hidden attribute now actually hide (the
  .workspace display:grid rule was overriding the UA [hidden] style)
- SW cache bumped to v4, precaches pathfinding.js; manifest/README/
  CHANGELOG rebranded to Algorithm Lab

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant