Tech Store

Showing suggestions.

Opening the store's index…
↑↓ to move↵ to openesc to close
Tech Store search
Animationv1.0.0~15 KB gzipped

Pathfinding Maze

An editable neon maze where BFS, Dijkstra, A* and greedy search race to the goal, step by step

FreeFree
Format

.zip · HTML / CSS / JS · v1.0.0

Free — no account, no email. Always the newest version.

Live preview

Version
Preview width
Zoom

About

A maze you can draw on, and four search algorithms you can watch think. The frontier ripples out cell by cell, every visited cell takes a colour from the order it was reached, and when the goal is found the path draws itself in as a glowing line. Paint mud, drag the goal, and see A* pick a different road — or put two algorithms side by side and let them race on the same board.

Made for lessons, slides and videos: every step has a plain-words caption and its line of pseudocode lit up, and the neon-on-ink look reads well on a projector and in a recording.

  • BFS, Dijkstra, A* and greedy best-first, with the counters that tell them apart
  • BFS and A* follow the free Grid Pathfinding page exactly: same neighbour order, same ties, same stop rule
  • Seeded mazes and random walls, so a recording can be made twice and look the same
  • Every colour, radius and timing is a CSS custom property
  • Nothing to install: one CSS file and one script, or one React component

Features · 10

  • Four searches: BFS, Dijkstra, A* (Manhattan) and greedy best-first
  • Draw and erase walls, paint mud that costs 5 to cross, drag the start and the goal
  • Seeded maze generator (recursive backtracker) and random walls: the same seed, the same board
  • The frontier ripples out, visited cells shift colour in visiting order, the path draws itself in
  • Compare mode: two algorithms side by side on the same board, the better counts starred
  • Player: play, pause, step, scrub, 0.5×–4× speed, live pseudocode and plain-words captions
  • Counters: cells visited, frontier, path length, path cost and the step
  • Edit a solved maze and the path re-routes on the spot
  • BFS and A* follow the free Grid Pathfinding page line for line
  • Plain HTML/CSS/JS and React (Next.js ready) builds, zero dependencies

How to use it

Link the stylesheet and the script once, then mark an empty element with data-pathfinding-maze. The maze — tools, board, pseudocode, counters and player — is built inside it:

HTML
<link rel="stylesheet" href="pathfinding-maze.css" />
<script src="pathfinding-maze.js" defer></script>

<div data-pathfinding-maze data-pathfinding-algorithm="astar" data-pathfinding-mud="0.06"></div>

<div data-pathfinding-maze data-pathfinding-algorithm="bfs" data-pathfinding-compare="dijkstra"
     data-pathfinding-layout="random" data-pathfinding-autoplay="false"></div>

Options as data attributes (data-pathfinding-…):

Attribute Default What it does
-algorithm astar bfs, dijkstra, astar or greedy
-compare off A second algorithm side by side on the same board; empty = Dijkstra (BFS against Dijkstra)
-cols, -rows 31, 17 Board size in cells, 5–99 each
-layout maze What the board starts as: maze, random (walls) or empty
-seed 7 Seed of the maze and the random walls: the same seed, the same board
-mud 0 Share of the open cells the layouts turn to mud, 0–0.5
-speed 1 0.25–4 (the menu offers 0.5×, 1×, 2×, 4×)
-autoplay on Play on load — never with prefers-reduced-motion; "false" to wait for Play
-loop off Start over at the end

Mazes added after the page loads: PathfindingMaze.init(container), or PathfindingMaze.createPathfindingMaze(element, { algorithm: "dijkstra" }) — both return a function that removes the maze again. PathfindingMaze.traceSearch(board, "astar") hands you the frames themselves, if you want to draw them your own way.

Ask about this product

Not sure it fits your project? Ask — the answer comes from this page.

Answers are written by AI from this page and can be wrong. The page itself is what counts.

Changelog

  1. 1.0.0First releaseLatest

    Plain HTML/CSS/JS and React builds of an editable maze that animates BFS, Dijkstra, A* and greedy best-first step by step, with mud, a seeded maze generator, side-by-side compare, pseudocode, keyboard and reduced-motion support.

  2. Fixes and new features land behind the same download, which always serves the latest version.