The Wumpus World in AI

Table of Content:

Content Highlight:

The Wumpus world is a classic AI problem where an agent navigates a cave to find gold while avoiding pits and a deadly Wumpus. The agent uses senses to perceive its environment and must make decisions to maximize rewards and minimize penalties. The environment is partially observable, deterministic, sequential, static, discrete, and single-agent.

What is the Wumpus World in Artificial intelligence?

The Wumpus world is a classic example used in artificial intelligence to demonstrate the capabilities of knowledge-based agents and the principles of knowledge representation. It draws inspiration from the 1973 video game "Hunt the Wumpus" by Gregory Yob.

In the Wumpus world, we have a cave consisting of 4x4 rooms interconnected by passageways, totaling 16 rooms. The cave is inhabited by a dangerous beast known as the Wumpus, which will devour anyone who enters its room. The agent, our knowledge-based entity, must navigate this perilous environment. The cave also contains bottomless pits, and falling into one means the agent is trapped forever. Amidst this danger, one room holds a precious heap of gold.

The agent's objective is to find the gold and safely exit the cave without encountering the Wumpus or falling into a pit. Shooting the Wumpus is possible, but the agent has only one arrow. Successfully retrieving the gold and leaving the cave results in a reward, while being eaten by the Wumpus or falling into a pit incurs a penalty.

The diagram below illustrates a sample representation of the Wumpus world. It depicts various rooms with pits, one room containing the Wumpus, and the agent positioned at the (1, 1) square location within the world.

The Wumpus World in Artificial Intelligence (AI)

The cave's environment provides several cues to aid the agent in its exploration:

  1. Stench: Rooms neighboring the Wumpus emanate a putrid stench, hinting at the creature's nearby presence.
  2. Breeze: Adjacent to bottomless pits, rooms are filled with a faint breeze, signaling the danger of an abyss.
  3. Glitter: Rooms containing gold are adorned with sparkling treasures, enticing the agent's pursuit.
  4. Scream: When the agent faces the Wumpus and fires its arrow, the Wumpus emits a harrowing scream that echoes throughout the cave, indicating a successful elimination.

PEAS description of Wumpus world:

We have given PEAS description as below to explain the Wumpus world:

Performance measure:

The agent's performance is measured by its ability to maximize rewards and minimize penalties. It receives a positive reward for successfully retrieving the gold and safely exiting the cave. It incurs a negative penalty for falling into pits or being eaten by the Wumpus.

  • The agent earns +1000 reward points for successfully exiting the cave with the gold.
  • The agent incurs a -1000 points penalty for being eaten by the Wumpus or falling into a pit.
  • Each action performed by the agent incurs a -1 point penalty, and using an arrow incurs a -10 point penalty.
  • The game ends if the agent either dies (eaten by the Wumpus or falls into a pit) or successfully exits the cave with the gold.

Environment:

The Wumpus world is a complex cave system consisting of interconnected rooms. Each room can either be safe, contain a bottomless pit, house the Wumpus, or hold a glittering pile of gold. The agent must explore this environment, using its senses and intelligence to navigate safely.

  • The cave is represented by a 4x4 grid of rooms.
  • The agent starts in room [1, 1], facing to the right.
  • The locations of the Wumpus and gold are randomly chosen for each game, except they cannot be in the first square [1, 1].
  • Each square of the cave has a 20% probability of being a pit, except for the first square.

Actuators:

The agent can perform various actions in the environment. It can move to adjacent rooms, shoot an arrow in a straight line to potentially kill the Wumpus, grab gold in the current room, and climb out of the cave to exit.

  • Left turn
  • Right turn
  • Move forward
  • Grab
  • Release
  • Shoot

Sensors:

The agent relies on its sensors to perceive the environment. It can detect a stench in adjacent rooms (indicating the presence of the Wumpus), a breeze in adjacent rooms (indicating a pit), glitter in the current room (indicating gold), and the Wumpus's scream (indicating a successful elimination if the Wumpus is shot).

  • The agent perceives a stench if it is in a room adjacent to the Wumpus (excluding diagonal rooms).
  • The agent perceives a breeze if it is in a room directly adjacent to a pit.
  • The agent perceives glitter in the room where the gold is present.
  • The agent perceives a bump if it walks into a wall.
  • When the Wumpus is shot, it emits a horrible scream that can be heard anywhere in the cave.

These percepts can be represented as a five-element list, with different indicators for each sensor. For example, if the agent perceives a stench and a breeze, but no glitter, bump, or scream, it can be represented as: [Stench, Breeze, None, None, None].

The Wumpus world Properties:

  • Partially Observable: The Wumpus world is partially observable because the agent can only perceive its immediate surroundings, such as adjacent rooms.
  • Deterministic: It is deterministic, meaning the results and outcomes of actions in the world are already known.
  • Sequential: The environment is sequential, indicating that the order of actions is important.
  • Static: The environment is static as the Wumpus and pits do not move.
  • Discrete: The environment is discrete, with distinct, separate states.
  • One Agent: The environment is single-agent, as there is only one agent, and the Wumpus is not considered an agent.

Exploring the Wumpus world:

Agent's First step:

Initially, the agent is in the first room or on the square [1,1], and we already know that this room is safe for the agent, so to represent on the below diagram (a) that room is safe we will add symbol OK. Symbol A is used to represent agent, symbol B for the breeze, G for glitter or gold, V for the visited room, P for pits, W for Wumpus.

At Room [1,1] agent does not feel any breeze or any stench which means the adjacent squares are also OK.

Agent's first step in the Wumpus World in AI

Agent's second Step:

After deciding to move forward, the agent has two options: either move to [1, 2] or [2, 1]. Let's assume the agent chooses to move to [2, 1]. In this room, the agent detects a breeze, indicating the presence of a pit nearby. The pit could be in [3, 1] or [2, 2]. To indicate uncertainty, we add the symbol P? to these squares.

Upon sensing the breeze, the agent stops and considers its options, avoiding any potentially harmful moves. It decides to backtrack to the [1, 1] room. Both [1, 1] and [2, 1] are marked as visited using the symbol V.

Agent's third step:

At the third step, the agent moves to the room [1,2], which is OK. In this room, the agent perceives a stench, indicating the presence of a Wumpus nearby. However, the Wumpus cannot be in [1,1] (according to the rules of the game) and also not in [2,2] (since the agent did not detect any stench when it was at [2,1]). Therefore, the agent infers that the Wumpus is in the room [1,3].

In the current state, there is no breeze, which means there is no pit in [2,2] and no Wumpus. So, [2,2] is marked as safe (OK), and the agent moves further to [2,2].

Agent's third step in the Wumpus World in AI

Agent's fourth step:

At room [2,2], there are no stenches or breezes present. Let's suppose the agent decides to move to [2,3]. In room [2,3], the agent perceives glitter, indicating the presence of gold. The agent should grab the gold and climb out of the cave.