The Wumpus World

Introduction

The Wumpus World is the running example of Chapter 7. It is simple enough to analyze completely yet rich enough to require genuine logical reasoning. It motivates why we need a KB, why propositional logic is appropriate, and why inference is necessary to act safely.


Environment Description

A 4×4 grid. The agent starts at [1,1] facing right.

Element Count Properties
Wumpus 1 Fixed, not at [1,1]. Kills on contact. Can be killed by the agent’s single arrow.
Pits ~3 Fixed, not at [1,1]. Agent falls and dies.
Gold 1 Fixed. Grab and return to [1,1] to win.
Walls Boundary Agent cannot move through.

Percepts (5-tuple): [Stench, Breeze, Glitter, Bump, Scream]

Percept Meaning
Stench Wumpus in an adjacent square (4-connected, not diagonal)
Breeze A pit in an adjacent square
Glitter Gold in the current square
Bump Walked into a wall
Scream Wumpus was killed (arrow hit)

Absence of a percept is equally informative: no breeze means no adjacent pits.

Actions

Forward, TurnLeft, TurnRight, Grab, Shoot, Climb.

PEAS

Partial observability forces inference — the agent cannot see pit/Wumpus locations directly.


Worked Example: Step-by-Step Reasoning

Standard configuration: Wumpus at [1,3], Pits at [3,1],[3,3],[4,4], Gold at [2,3].

t=0, at [1,1]: Percept = [None, None, None, None, None] - No stench → Wumpus not adjacent. No breeze → no adjacent pits. - Safe to visit: [1,2] and [2,1].

t=1, at [2,1]: Percept = [None, Breeze, None, None, None] - Breeze → pit in {[1,1],[2,2],[3,1]}. [1,1] is safe. So pit in [2,2] or [3,1]. - [2,2] and [3,1] are dangerous — do not visit yet.

t=2, at [1,2]: Percept = [Stench, None, None, None, None] - Stench → Wumpus in {[1,1],[1,3],[2,2]}. - No breeze → no pits adjacent → [1,3],[2,2] have no pit (consistent with t=1: pit in [3,1]). - Combined with t=1: pit not in [2,2] → pit is at [3,1]. - Wumpus: not in [1,1] (start). If in [2,2]: would have caused stench at [2,1] — but [2,1] had no stench. → Wumpus is at [1,3]. ✓

Every step is a logical inference automatically derivable from the KB.


Propositional Encoding

Symbol Meaning
P_i_j Pit at [i,j]
W_i_j Wumpus at [i,j]
B_i_j Breeze at [i,j]
S_i_j Stench at [i,j]
OK_i_j Square [i,j] is safe

Key axioms:

B_i_j ↔ (P_{i+1,j} ∨ P_{i-1,j} ∨ P_{i,j+1} ∨ P_{i,j-1})
S_i_j ↔ (W_{i+1,j} ∨ W_{i-1,j} ∨ W_{i,j+1} ∨ W_{i,j-1})
¬P_1_1   ¬W_1_1
OK_i_j ↔ ¬P_i_j ∧ ¬W_i_j

Limitations of Propositional Logic for This Domain

  1. Scale: One symbol per square per fact. A 100×100 grid → 10,000+ symbols per relation.
  2. Time: Agent position across timesteps needs time-indexed symbols → exponential blowup.
  3. No uncertainty: Binary truth values; cannot handle noisy sensors.

These limitations motivate first-order logic (Ch. 8) and probabilistic reasoning (Ch. 12–13).