A Rust implementation of the classic Wumpus World AI problem, featuring both interactive player-controlled and autonomous knowledge-based agent gameplay.
Wumpus World is a grid-based exploration game where an agent navigates a cave system to find gold while avoiding dangers like pits and the Wumpus (a dangerous creature). This project implements both a playable game mode and an intelligent AI agent that uses knowledge-based reasoning to make decisions.
- Player Mode: Manually control an agent as it explores the cave
- Agent Mode: Watch an AI-driven agent automatically navigate using knowledge-based reasoning
- Interactive TUI: Terminal-based user interface for game interaction
- Knowledge Base System: Logic-based reasoning for agent decision-making
- Score Tracking: Track performance with penalties for moves and hazards, rewards for gold
- Rust 1.87.0 or later
- Cargo
- Clone the repository
- Build and run the project:
cargo run
src/main.rs: Entry point and game loopsrc/agent.rs: Core agent types and actionssrc/agents.rs: Knowledge-based agent implementationsrc/env.rs: Game environment and rulessrc/grid.rs: Grid and position utilitiessrc/kb.rs: Knowledge base data structuressrc/logic.rs: Logical reasoning enginesrc/room.rs: Room and object typessrc/tui.rs: Terminal user interface
The knowledge-based agent maintains a knowledge base of facts about the world, including:
- Safe and unsafe locations
- Wumpus and pit potential positions
- Locations with sensory cues
Based on observations, the agent uses logical reasoning to infer new facts and make decisions about which direction to move or whether to shoot an arrow.