An advanced AI-powered pirate treasure hunting game where three specialized AI agents work together to navigate treacherous waters, collect treasures, and battle enemies using LangGraph and local LLM integration.
Navigate a pirate ship across a 30x30 grid map using three AI agents that collaborate to make strategic decisions:
- 🧭 Navigator: Scans the environment and provides reconnaissance reports
- ⚔️ Cannoneer: Handles combat operations and threat assessment
- 👨
✈️ Captain: Makes final strategic decisions and coordinates the crew
- LangGraph Integration: Advanced AI workflow with specialized agent roles
- Local LLM Support: Uses Ollama for private, local AI processing
- Custom System Prompts: Editable prompts via web interface for each agent
- Real-time Decision Making: Agents analyze game state and make tactical decisions
- Responsive 3-Column Layout: System prompts, game map, and agent outputs
- Material Icons: Professional UI with Google Material Design icons
- Real-time Updates: Live agent responses and tool outputs via polling
- Chrome DevTools Integration: Live editing capabilities with workspace mapping
- Strategic Movement: Up to 3-tile movement per turn with path validation
- Resource Management: Limited cannonballs with treasure collection rewards
- Dynamic Enemies: Moving enemies and monsters with AI behavior
- Multiple Objectives: Collect treasures while avoiding or defeating threats
- Python 3.9+
- Ollama installed and running locally
- Chrome browser (recommended for DevTools integration)
-
Clone the repository
git clone https://github.com/bradmonk/pirates.git cd pirates -
Set up Python environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Install an Ollama model
ollama pull llama3.1:latest
-
Start the game
./restart.sh
-
Open the web interface
- Navigate to
http://localhost:8000in Chrome - Select an AI model from the dropdown
- Click "Start Game" and watch the AI agents play!
- Navigate to
- Use the left panel to modify each agent's behavior
- Real-time prompt updates without restarting the game
- Experiment with different strategic approaches
pirates/
├── index.html # Main web interface
├── styles.css # Separated CSS styling
├── web_gui.py # HTTP server and web interface logic
├── ai_agents.py # LangGraph AI agents implementation
├── game_state.py # Game mechanics and state management
├── game_tools.py # Agent tools for game interaction
├── pirate_game.py # Main game coordination
├── map.csv # Game map definition
├── requirements.txt # Python dependencies
├── restart.sh # Development startup script
./restart.shThis script automatically:
- Cleans up previous instances
- Activates the Python virtual environment
- Starts the web server at
http://localhost:8000 - Initializes the game with Ollama integration
LangGraph Workflow: The game uses a sophisticated AI agent system where each agent has specialized tools and responsibilities. Agents communicate through a shared game state and make decisions based on their observations.
Web Interface: Built with vanilla JavaScript and modern CSS, featuring real-time data polling for live updates of AI agent decisions and game state changes.
Local LLM Integration: Utilizes Ollama for private, local language model processing, ensuring data privacy while maintaining powerful AI capabilities.
- Objective: Collect all treasures while avoiding or defeating enemies
- Movement: Ship can move up to 3 tiles per turn (North/South/East/West)
- Combat: Cannons have 2-tile range and cost 1 cannonball per shot
- Resources: Start with 25 cannonballs, gain 2 per treasure collected
- Hazards: Contact with enemies or monsters causes damage
- Victory: Collect all treasures to win the game
Contributions are welcome! Areas for enhancement:
- New AI agent strategies and behaviors
- Additional map types and game modes
- Enhanced web interface features
- Performance optimizations
- Mobile responsiveness improvements
This project is licensed under the MIT License - see the LICENSE file for details.
- LangGraph: For the powerful AI agent framework
- Ollama: For local LLM capabilities
- Material Design: For the clean icon system
- Chrome DevTools: For the innovative workspace integration
Ahoy, matey! May the winds fill your sails and the AI guide your treasure hunt! ⚓🏴☠️💰