Nov 12, 2026 · Rukshan Dias

A planning agent that solves Wumpus World live

Wumpus World AI Planning (PDDL)

Key result
3.9 to 5.8× fewer nodes, A* vs BFS (median)
Key result
1,200 random worlds benchmarked
Key result
900 test worlds, every plan valid
Key result
$0 hosting
Wumpus Planner Live: three planners (BFS, A*, greedy) solving a 4×4 Wumpus World, with the search effort glowing on the grid and the PDDL action being executed highlighted.
Wumpus Planner Live: three planners (BFS, A*, greedy) solving a 4×4 Wumpus World, with the search effort glowing on the grid and the PDDL action being executed highlighted.
01

Summary

I turned my SIT215 Wumpus World planning assignment into a live demo: a planner that solves a fresh Wumpus World in the browser every few seconds, with no input needed. Over 1,200 random worlds, A* expands a median 3.9 to 5.8 times fewer nodes than breadth-first search (BFS) while finding the same optimal plan. It costs $0 to host and lets visitors watch three search algorithms compete on the same world.

Stack

Original assignment
PDDL, BFWS and LAMA-First (Fast Downward)
Demo
Plain JavaScript and canvas
Deployment
GitHub and Netlify
02

Problem and goal

A notebook full of solver timings proves the assignment ran, but it does not show a recruiter that the planner works or why one algorithm beats another. I wanted a link that a visitor understands in under a minute, built on work I had already done.

The constraints were deliberate:

  • Keep the PDDL visibleThe demo shows the real move, take and shoot actions from my domain as the agent executes them.
  • No backendStatic files only, so nothing can break or cost money.
  • No dependencies at runtimeThe planner is plain JavaScript.
  • Self-runningA visitor sees something happening without clicking anything.
03

The assignment

The starting point was SIT215 Assignment 3: model Wumpus World in PDDL and compare two planners on it. The world is a 4×4 grid with an agent, an arrow, gold, a Wumpus and pits. The domain has three actions, move, take and shoot. A corrected version adds guards: a dead agent cannot act, an arrow can only be used once, and a flag records whether the Wumpus is alive.

Problem file
Problem fileValue
Agent startssq-1-1, with the arrow
Goldsq-2-3
Wumpussq-1-3
GoalHold the gold and be back at sq-1-1

My notebook compared two solvers on it.

Notebook results for the assignment problem
SolverPlanning time (s)Nodes generatedNodes expandedPlan lengthPeak memory (KB)
BFWS (FF parser)0.000456895810not recorded
LAMA-First (Fast Downward)0.02797152121012,500

LAMA-First expanded about 5 times fewer nodes (12 against 58) but took about 60 times longer. On a problem this small that likely reflects fixed startup cost rather than search effort, which is why the demo reports expanded nodes.

04

Approach

The demo re-implements the domain's three actions as a search problem and runs it in the browser. A state is four facts: the agent's square, whether it holds the gold, whether it still has the arrow, and whether the Wumpus is alive. That gives 128 states on a 4×4 grid and 288 on a 6×6.

  • moveStep to an adjacent square that is not a pit.
  • takePick up the gold when standing on it.
  • shootFire the arrow at a living Wumpus on an adjacent square.

The goal matches the assignment: hold the gold and be back at the start.

One rule is my addition, behind a toggle. The PDDL domain lets the agent walk straight through the Wumpus's square, but the classic game does not. With the rule on, the Wumpus blocks its square, so shooting becomes worth using.

Three algorithms search the same state space.

Search algorithms compared
SolverFrontier ordered byFinds the shortest plan?
BFSSteps takenYes
A*Steps taken plus a heuristicYes, because the heuristic never overestimates
Greedy best-firstHeuristic onlyNo

The heuristic is the Manhattan distance to the gold, one step to take it, then the distance back to the start. It ignores pits and the Wumpus, so it never overestimates.

A* heuristic · d = Manhattan distance, p = agent's square

Before taking the gold, h of s equals the Manhattan distance from p to the gold, plus 1, plus the distance from the gold to the start. After taking it, h of s equals the distance from p to the start.

Each episode builds a random world that is guaranteed solvable. The gold sits at least n−1 squares from the start, and the Wumpus is placed next to the gold in 60% of worlds so that shooting is sometimes the only way through. Pits number 2 or 3 on 4×4, 4 on 5×5 and 6 on 6×6, and BFS rejects any world with no plan.

05

Product and UI

The demo is designed to show the planner thinking, not just a final answer. It uses a dark, minimal interface with a near-black background, hairline borders and an indigo accent, matching my Snake project.

Wumpus Planner Live: three planners (BFS, A*, greedy) solving a 4×4 Wumpus World, with the search effort glowing on the grid and the PDDL action being executed highlighted.
Wumpus Planner Live: three planners (BFS, A*, greedy) solving a 4×4 Wumpus World, with the search effort glowing on the grid and the PDDL action being executed highlighted.
  • Live world: the agent, gold, Wumpus and pits, with breeze and stench markers. An indigo glow shows where the search spent its effort, then the agent walks the plan.
  • Plan steps: the plan as a row of chips, with the current step highlighted.
  • Solver table: all three solvers run on every world, showing nodes generated, nodes expanded, plan length and time. The best value in each column turns green.
  • PDDL panel: the move, take or shoot action being executed lights up in the domain text, beside the grounded step, for example (move agent sq-1-1 sq-2-1).
  • Chart: nodes expanded per world for the three solvers, with hover tooltips.
  • Controls: solver switch, 4×4, 5×5 or 6×6 grid, speed from 0.5× to 4×, the Wumpus-blocking toggle, pause on the space bar and next world on the right arrow. The layout works on a phone.

A world takes a few seconds at normal speed, then a new one loads. The first world uses the layout from my wumpus.pddl file.

06

Results

A* beats BFS by a margin that grows with the grid, while finding the same shortest plan.

A* expands about 5× fewer nodes than BFS on a 6×6 grid

Average nodes expanded per world, 400 random worlds per grid size

  • BFS
  • A*
  • Greedy
Average nodes expanded per world, by solver and grid sizeGrouped bar chart. 4×4: BFS 41.1, A* 12.2, Greedy 11.5, BFS divided by A* equals 3.4×. 5×5: BFS 66.2, A* 16.1, Greedy 14.8, BFS divided by A* equals 4.1×. 6×6: BFS 100.4, A* 19.8, Greedy 17.9, BFS divided by A* equals 5.1×.Nodes expanded (mean)02550751004×4 · BFS: 41.1 nodes expanded (mean)41.14×4 · A*: 12.2 nodes expanded (mean)12.24×4 · Greedy: 11.5 nodes expanded (mean)11.54×4BFS ÷ A* = 3.4×5×5 · BFS: 66.2 nodes expanded (mean)66.25×5 · A*: 16.1 nodes expanded (mean)16.15×5 · Greedy: 14.8 nodes expanded (mean)14.85×5BFS ÷ A* = 4.1×6×6 · BFS: 100.4 nodes expanded (mean)100.46×6 · A*: 19.8 nodes expanded (mean)19.86×6 · Greedy: 17.9 nodes expanded (mean)17.96×6BFS ÷ A* = 5.1×

Mean of 400 random worlds per grid size (seeds 1 to 400), Wumpus blocks its square, run with the demo's planner.js.

The chart shows the ratio of mean nodes (3.4, 4.1, 5.1×) while the text below uses the median per-world ratio (3.9, 4.6, 5.8×). Both are correct; they are different statistics.

A* and BFS always return plans of equal length, because both find the shortest one. Greedy search expands 6 to 10% fewer nodes than A* but returns a longer plan in 25 of 400 worlds on 4×4, 55 on 5×5 and 76 on 6×6. The median BFS-to-A* ratio of expanded nodes is 3.9 on 4×4, 4.6 on 5×5 and 5.8 on 6×6. Shooting the Wumpus was part of the shortest plan in 82, 74 and 57 of the 400 worlds respectively.

Per-world results by grid size, 400 worlds each
GridMedian BFS ÷ A*Greedy plan longerShot in shortest plan
4×43.9×25 of 40082 of 400
5×54.6×55 of 40074 of 400
6×65.8×76 of 40057 of 400

On the first world, which uses the layout from wumpus.pddl, BFS expands 44 nodes and A* and greedy expand 8, all finding a 7-step plan.

07

Limitations

08

Shipping at $0

Everything runs in the browser, so the site is a folder of static files: index.html and planner.js in the repo's web folder. Netlify deploys from the main branch with the publish directory set to web and no build command.

Running costs
ItemCost
Compute$0 (the visitor's browser)
Hosting$0 (free static hosting)
Domain$0 (default netlify.app subdomain)
Backend and databaseNone needed
09

What I learned and what's next

What I learned

  • Heuristic quality sets the cost of search: A* expands a median 3.9 to 5.8 times fewer nodes than BFS, and the gap grows with the grid.
  • Greedy search's small saving costs plan quality. It expands 6 to 10% fewer nodes than A* but returns a longer plan in 6% of 4×4 worlds and 19% of 6×6 worlds.
  • Implementing a domain exposes rules it leaves out. My PDDL never stops the agent walking into the Wumpus, which I only noticed when writing the search.
  • Showing the search as a heat map explains more than a table of counts.

What's next

  • Run the PDDL files through Fast Downward on the same worlds to verify the browser plans.
  • Add fog of war, where the agent senses breeze and stench and replans, as in the classic game.
  • Let visitors click to place pits and the Wumpus.
  • Commit the benchmark script so the results can be reproduced.

Watch three search algorithms compete

Watch a fresh world solve in the live demo, or read the planner and PDDL files on GitHub.

Back to all projects