On-Device AI Hackathon co-hosted by Qualcomm Technologies, Microsoft, and Northeastern University. Won Second Place out of 28 teams and the People's Choice Award
A narrative-driven Connect Four game powered by local LLMs that react to your moves with dynamic storytelling.
ConquestFour transforms the classic Connect Four game into an immersive narrative experience using local large language models. Instead of reinventing the wheel, we've enhanced a familiar game with AI-powered storytelling that runs entirely on your device - no internet connection required!
The game features an intelligent AI opponent that not only challenges your strategic thinking but also narrates the game with contextual commentary, adapting its tone based on your play style and move quality.
- Intelligent AI Opponent: Three difficulty levels (Easy, Medium, Hard) with different play styles
- Narrative Generation: LLM provides contextual commentary on moves using Mistral-7B
- Thermal Management: Automatically detects system temperature and scales AI operations
- Themed Experience: Narratives adapt to different contextual themes (Western, Fantasy, Sci-Fi)
- Interactive Chat: Communicate directly with the AI during gameplay
- Local Processing: All AI processing runs locally - no data leaves your device
[Gameplay Screenshot] [Narrative Example]
- Python 3.9-3.12 (Do not go past 3.12 or compatibility issues)
- Ollama - for running local LLMs
- FFmpeg (for speech features)
-
Clone the repository:
git clone https://github.com/your-username/llm-conquestfour.git cd llm-conquestfour -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate.bat
-
Install dependencies:
pip install -r requirements.txt
-
Install and start Ollama:
# Install from https://ollama.com/ # Then run: ollama serve
-
Download the Mistral model:
# In a separate terminal ollama pull mistral
For Windows users, we provide automated setup scripts:
# Using Git Bash
./demo/setup_windows_gitbash.sh
# Or using Command Prompt
demo\run_game_windows.batSee Windows Setup Guide for detailed instructions.
To start the game, execute the following command:
python main.py- Click on a column to drop your piece
- Use the chat box to communicate with the AI narrator
- Select different themes and difficulty levels in the settings menu
ConquestFour is built with a modular architecture:
- Game Logic Core: Python implementation with minimax algorithm and alpha-beta pruning
- UI Layer: PyQt6-based responsive user interface
- AI Engine: Local LLM integration via Ollama (Mistral-7B)
- Narrative System: Context-aware prompt generation with themed templates
- System Monitoring: Thermal-aware performance adjustment
├── ai/ # AI and LLM integration
├── game/ # Core game logic and minimax implementation
├── ui/ # PyQt6 user interface
├── speech_to_text/ # Speech recognition (optional)
├── text_to_speech/ # Text-to-speech synthesis (optional)
├── templates/ # Narrative templates
└── assets/ # Game assets and images
- Voice Integration: Speech-to-text and text-to-speech for natural conversation
- NPU Acceleration: Optimizations for neural processing units
- Dynamic Difficulty: AI that learns from your play style
- Extended Narrative Memory: AI remembers previous games
- Expanded Themes: Additional themes with unique narrative styles
- "Connection refused" error: Make sure Ollama is running (
ollama serve) - "Model 'mistral' not found": Download the model (
ollama pull mistral) - Performance issues: Check system temperature, the game will automatically reduce computational load
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for a 24-hour Hackathon
- Inspired by classic Connect Four gameplay
- Powered by Ollama and Mistral AI
- UI built with PyQt6
