Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

🧠 This repository features an intelligent agent that autonomously explores the Wumpus World—a grid filled with hidden Wumpuses, pits, and gold. Using logic, inference, and planning, the agent avoids dangers, finds gold, and escapes. Includes real-time Pygame visualization and customizable settings, ideal for AI/game logic study and experimentation

License

Notifications You must be signed in to change notification settings

NhanPhamThanh-IT/Wumpus-World-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wumpus World Game

Python License Platform Pygame

An intelligent agent simulation of the classic Wumpus World problem, featuring a graphical interface and advanced reasoning modules. The agent explores a grid-based world, avoids deadly Wumpuses and pits, and tries to retrieve the gold and escape safely.

Demo

Wumpus World Demo

Table of Contents

Features

  • Customizable grid size, number of Wumpuses, and pit probability
  • Moving Wumpus option for advanced challenge
  • Intelligent agent with knowledge base, inference engine, and planning module
  • Pygame-based graphical interface
  • Real-time display of agent's percepts, actions, and score
  • Modular code for easy extension and experimentation

Installation

  1. Clone the repository:
    git clone https://github.com/NhanPhamThanh-IT/Wumpus-World-Game.git
  2. Install Python 3.11+ and pip
  3. Install required packages:
    pip install pygame

Usage

Run the game from the command line:

python main.py

You will be prompted to enter:

  • Grid size (default: 8)
  • Number of Wumpuses (default: 2)
  • Pit probability (default: 0.2)

Game Controls

  • The agent is fully autonomous; you only need to set the initial parameters.
  • To quit, close the game window.

Project Structure

main.py                # Entry point, runs the game loop
config/environment.py  # World generation and environment logic
logic/agent.py         # Agent reasoning and decision-making
logic/knowledge_base.py# Agent's knowledge representation
logic/inference_engine.py # Logical inference for safe/risky cells
logic/planning_module.py  # Pathfinding and planning
ui/visualization.py    # Pygame-based GUI
README.md, LICENSE     # Documentation and license

How It Works

  1. Environment:
    • Generates a grid with Wumpuses, pits, and gold.
    • Updates percepts (stench, breeze, glitter) for each cell.
  2. Agent:
    • Maintains a knowledge base of visited and inferred cells.
    • Uses an inference engine to deduce safe/risky cells.
    • Plans paths to gold, safe unvisited cells, or escape.
    • Executes actions: move, turn, grab, climb out, shoot arrow.
  3. Visualization:
    • Displays the grid, agent, hazards, and percepts.
    • Shows agent's score, last action, and percepts in real time.

Credits

  • Developed by Nhan Pham Thanh
  • Inspired by the classic AI Wumpus World problem

License

This project is licensed under the MIT License. See LICENSE for details.

Contributing

Contributions, bug reports, and suggestions are welcome! Feel free to open issues or submit pull requests.

Troubleshooting

  • If you encounter issues with Pygame, ensure your Python and pip versions are up to date.
  • For graphical errors, check your system's graphics drivers and Pygame installation.
  • For any other problems, please open an issue on the GitHub repository.

Useful Links

Table of Contents

Features

  • Customizable grid size, number of Wumpuses, and pit probability
  • Moving Wumpus option for advanced challenge
  • Intelligent agent with knowledge base, inference engine, and planning module
  • Pygame-based graphical interface
  • Real-time display of agent's percepts, actions, and score
  • Modular code for easy extension and experimentation

Installation

  1. Clone the repository:
    git clone https://github.com/NhanPhamThanh-IT/Wumpus-World-Game.git
  2. Install Python 3.11+ and pip
  3. Install required packages:
    pip install pygame

Usage

Wumpus World Demo

Run the game from the command line:

python main.py

You will be prompted to enter:

  • Grid size (default: 8)
  • Number of Wumpuses (default: 2)
  • Pit probability (default: 0.2)

Contributing

Contributions, bug reports, and suggestions are welcome! Feel free to open issues or submit pull requests.

Troubleshooting

  • If you encounter issues with Pygame, ensure your Python and pip versions are up to date.
  • For graphical errors, check your system's graphics drivers and Pygame installation.
  • For any other problems, please open an issue on the GitHub repository.

Useful Links

Project Structure

main.py                # Entry point, runs the game loop
config/environment.py  # World generation and environment logic
logic/agent.py         # Agent reasoning and decision-making
logic/knowledge_base.py# Agent's knowledge representation
logic/inference_engine.py # Logical inference for safe/risky cells
logic/planning_module.py  # Pathfinding and planning
ui/visualization.py    # Pygame-based GUI
README.md, LICENSE     # Documentation and license

How It Works

  1. Environment:
    • Generates a grid with Wumpuses, pits, and gold.
    • Updates percepts (stench, breeze, glitter) for each cell.
  2. Agent:
    • Maintains a knowledge base of visited and inferred cells.
    • Uses an inference engine to deduce safe/risky cells.
    • Plans paths to gold, safe unvisited cells, or escape.
    • Executes actions: move, turn, grab, climb out, shoot arrow.
  3. Visualization:
    • Displays the grid, agent, hazards, and percepts.
    • Shows agent's score, last action, and percepts in real time.

Credits

  • Developed by Nhan Pham Thanh
  • Inspired by the classic AI Wumpus World problem

License

This project is licensed under the MIT License. See LICENSE for details.

About

🧠 This repository features an intelligent agent that autonomously explores the Wumpus World—a grid filled with hidden Wumpuses, pits, and gold. Using logic, inference, and planning, the agent avoids dangers, finds gold, and escapes. Includes real-time Pygame visualization and customizable settings, ideal for AI/game logic study and experimentation

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages