Wumpus World in AI

Learn via video courses
Topics Covered

Overview

The Wumpus World in AI is a classic problem demonstrating various ideas such as search algorithms, planning, and decision-making. The wumpus world in AI is a straightforward environment in which an agent (a computer program or a robot) must traverse a grid world filled with obstacles, hazards, and dangerous wumpus. Wumpus is a fictional character that kills the player in the game. The agent must travel the globe for a safe route to the treasure without falling into pits or being killed by the wumpus.

Introduction

wumpus world The Wumpus World in AI is a classic problem based on reasoning with knowledge where the scenario entails a world comprising a grid of chambers, each with pits, obstacles, and a wumpus. The agent's mission is to locate the gold and escape the world without being killed by wumpus or falling into a pit. The wumpus is a fierce creature that can detect the agent and kill it if it is in the same area as it. As a result, the agent can only perform a few activities, such as moving forward, turning, shooting an arrow, and grabbing the money.

The Wumpus World in AI is an important research problem because it offers a simple yet challenging setting for testing and developing intelligent agents. The problem has uncertainty, partial observability, and numerous objectives, making it a good test for different AI techniques like search algorithms, reinforcement learning, and planning. Real-world applications of the Wumpus World issue include designing intelligent agents for autonomous vehicles, robotics, and game creation.

In the following parts, we will examine the game rules and the various AI methods used to solve the Wumpus World problem. We will also discuss how the problem is pertinent in real-world applications and the difficulties in designing intelligent agents to deal with the Wumpus World.

What is Wumpus World in AI?

The Wumpus World in AI is a basic yet difficult AI environment that demonstrates search algorithms, planning, and decision-making concepts. It is a simulated world comprising a grid of rooms where an agent must negotiate obstacles, hazards, and a dangerous creature known as the wumpus. The agent's main goal is to find a safe way to the treasure and escape the world without falling into pits or being killed by the wumpus.

Properties of the Wumpus World

  • Partially observable: The Wumpus world in AI is partially observable because the agent can only sense the immediate surroundings, such as an adjacent room.
  • Deterministic: It is deterministic because the result and end of the world are already known.
  • Sequential: It is sequential because the order is essential.
  • Static: It is motionless because Wumpus and Pits are not moving.
  • Discrete: The surroundings are distinct.
  • One agent: The environment is a single agent because we only have one agent, and Wumpus is not regarded as an agent.

PEAS Description of Wumpus World

To build an intelligent agent for the Wumpus World, we must first define the problem's Performance, Environment, Actuators, and Sensors (PEAS).

  1. Performance:
    • +1000 bonus points if the agent returns from the tunnel with the gold.
    • Being eaten by the wumpus or plummeting into the pit results in a -1000 point penalty.
    • Each move is worth -1, and using an arrow is worth -10.
    • The game is over if either agent dies or exits the tunnel.
  2. Environment:
    • A four-by-four grid of chambers.
    • The operative begins in room square [1, 1], facing the right.
    • Wumpus and gold locations are selected randomly except for the first square [1,1].
    • Except for the first square, each square in the tunnel has a 0.2 chance of being a pit.
  3. Actuators: They are the actions that the agent can take to interact with the world. The worker in Wumpus World in AI can carry out the following tasks:
    • Left turn
    • Right turn
    • Move forward
    • Grab
    • Release
    • Shoot
  4. Sensors: They are how the agent senses its surroundings. The agent's instruments in the Wumpus World provide the following information:
    • If the agent is in the chamber next to the wumpus, he will notice the stench. (Not diagonally).
    • If the agent is in the room immediately adjacent to the pit, he will notice a breeze.
    • The agent will notice the glitter in the chamber with the gold.
    • The agent will notice the bump if he runs into a wall.
    • When the Wumpus is shot, it lets out a horrifying scream that can be heard throughout the tunnel.
    • These perceptions can be represented as a five-element list with distinct indicators for each sensor.
    • For example, if an agent detects stench and breeze but not glitter, bump, or scream, it can be depicted as [Stench, Breeze, None, None].

Wumpus World Cave Problem

The Wumpus world in AI is a cave with four chambers linked by passageways. So there are a total of 16 chambers that are linked to one another. We now have a knowledge-based agent who will advance in this universe. The cave has a chamber with a beast named Wumpus, who eats anyone who enters it. The agent can shoot the wumpus, but the agent only has one projectile. Some pit rooms in the Wumpus world in AI are bottomless, and if the agent falls into one of them, he will be stuck there eternally. The exciting aspect of this cave is discovering a heap of gold in one of its rooms. So the agent's objective is to locate the gold and climb out of the cave without being eaten by wumpus or falling into Pits. The agent will be rewarded if he returns with gold, but he will be punished if he is eaten by wumpus or slips into the pit.

Some elements can assist the agent in navigating the tunnel. These elements are listed below:

  • The rooms adjacent to the Wumpus chamber are stinky, so there will be a stench.
  • The room closest to the PITs has a breeze, so if the agent gets close to the PIT, he will notice the breeze.
  • Glitter will be present in the chamber if the room contains gold.
  • If the agent confronts the wumpus, it can be killed, and the wumpus will scream horribly, which can be heard throughout the cave. sample

Exploring the Wumpus World

We will now explore the Wumpus world in AI and use logical reasoning to determine how the agent will reach its objective.

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 we will add the symbol OK to the below diagram (a) to indicate that room is safe. Then, the agent is represented by symbol A, the breeze by symbol B, the glitter or gold by symbol G, the visited chamber by symbol V, the pits by symbol P, and the wumpus by symbol W.

The agent does not detect any breeze or Stench in Room [1,1], implying that the neighboring squares are also fine. sample2 Agent's second step: Now that the agent has to proceed forward, it will either go to [1, 2] or [2, 1]. Assume the agent moves to room [2, 1]. The agent detects a breeze in this chamber, indicating that the pit is nearby. The pit can be in [3, 1] or [2, 2], so we'll put the symbol P? to indicate whether or not this is a Pit room.

Now, the agent will pause and reflect before making any bad moves. Finally, the agent will return to the [1, 1] chamber. The agent visits rooms [1,1] and [2,1], so we will use V to symbolize the visited squares.

Agent's third step: At the third stage, the agent will proceed to room [1,2], which is fine. The agent detects a stench in the area [1,2], indicating the presence of a Wumpus nearby. But, according to the game's regulations, wumpus cannot be in the room [1,1] nor in [2,2]. (Agent had not detected any stench when he was at [2,1]). As a result, the agent deduces that the wumpus is in room [1,3], and in the present state, there is no breeze, implying that there is no Pit and no Wumpus in [2,2]. So it's safe, and we'll label it OK, and the agent will move in further [2,2]. sample3 Agent's fourth move: Because there is no stench or breeze in room [2,2], let us assume the agent chooses to relocate to [2,3]. The agent detects glitter in the room [2,3], so it should take the gold and climb out of the cave.

Applications of Wumpus World in AI

The Wumpus World in AI is a classic problem with multiple uses, including:

  • Developing intelligent agents: The Wumpus World in AI is an excellent platform for creating intelligent agents capable of navigating complicated environments, reasoning in uncertainty, and planning actions.
  • Testing AI algorithms: Wumpus World is a benchmark issue for testing and comparing various AI algorithms, such as search, planning, and reinforcement learning.
  • Education and training: Because it is simple to use and offers hands-on experience, the Wumpus World in AI is a popular tool for teaching AI concepts and algorithms to students.
  • Game Development: Wumpus World can motivate developers to create challenging and engaging games requiring strategic thinking and problem-solving.
  • Robotics: The Wumpus World can be used as a testing and development setting for robotics algorithms such as pathfinding and mapping.

Implementation of Wumpus Wolrd in Python

To begin, we must describe the layout of the Wumpus World, including the grid size, location of pits, wumpus, and treasure. The grid can be represented as a two-dimensional list, with each cell representing a cave chamber. The following code excerpt demonstrates how to initialize the grid with pits, wumpus, and treasure locations:

Next, we must describe the game logic, which includes the rules for moving, shooting, and detecting hazards. We can create a collection of functions to handle various aspects of the game, such as move(direction), shoot(direction), detect_hazards(), and game_over(). The accompanying code snippet demonstrates how to use the move(direction) function:

We can also use AI techniques like search, planning, and reinforcement learning to create intelligent agents capable of playing the game. We can, for example, use the A* Search algorithm to find the best route to the treasure or the Q-Learning algorithm to learn the best strategy for navigating the cave.

Conclusion

  • The Wumpus World is a classic AI challenge that offers a difficult environment for creating intelligent agents and testing AI algorithms.
  • The Wumpus World can be explored using various algorithms such as search, planning, and reinforcement learning to create intelligent agents.
  • The PEAS description of the Wumpus World aids in comprehending the game environment's properties and characteristics.
  • The goal of the Wumpus World is for the agent to find the gold and return to the starting position while avoiding falling into pits or getting eaten by the Wumpus monster.