A sophisticated war game simulator where different AI models (GPT, DeepSeek, Claude) control real countries and make strategic military decisions based on actual capabilities, geography, and economic data.
- GPT-4o-mini: Balanced strategist with diplomatic focus
- DeepSeek: Aggressive risk-taker with overwhelming force tactics
- Claude: Cautious diplomat emphasizing defensive positioning
- Actual GDP, military spending, and technology levels
- Geographic constraints (distance, terrain, borders)
- Real alliance systems and diplomatic relationships
- Nuclear capabilities and cyber warfare capacity
- Military: Army, Navy, Air Force operations with tech modifiers
- Cyber: Infrastructure attacks and system disruption
- Economic: Sanctions and financial warfare
- Diplomatic: Alliance formation and coalition building
- Intelligence: Reconnaissance and strategic planning
git clone https://github.com/yourusername/ai-war-games.git
cd ai-war-games
pip install -r requirements.txtcp .env.example .env
# Edit .env with your API keys:
# - OpenAI: https://platform.openai.com/api-keys
# - DeepSeek: https://platform.deepseek.com/
# - Anthropic: https://console.anthropic.com/# Quick demo (works without API keys)
python demo.py
# Test your API connections
python test_apis.py
# Interactive battle
python run_custom.py
# Single decision analysis
python single_decision_test.py# Middle East tension
Israel (GPT) vs Iran (DeepSeek)
# Pacific theater
USA (GPT) vs China (DeepSeek)
# Regional powers
India (Claude) vs Pakistan (GPT)The AIs make pragmatic decisions that often result in hilarious real-politik:
Turn 7: Ukraine forms strategic alliance with China
Turn 8: North Korea allies with United Kingdom
Turn 9: Iran recruits Germany as military partner
Why? The AIs prioritize winning over ideology, leading to pure game theory in action!
# AI strategists make real decisions
from ai_interface import GPTStrategist, DeepSeekStrategist, ClaudeStrategist
# Real country data with actual capabilities
from countries_database import COUNTRIES_DATABASE
# Combat resolution with geographic constraints
from war_simulator import WarSimulator, WarVisualizer- Context Analysis: AI receives military strength, economy, geography, recent events
- API Call: Real strategic decision via OpenAI/DeepSeek/Anthropic
- Combat Resolution: Geographic/technological modifiers applied
- State Update: Casualties, territory, alliances updated
- Victory Check: Multiple win conditions evaluated
| Country | GDP ($B) | Tech Level | Military Strength | Special Notes |
|---|---|---|---|---|
| United States | 27,000 | 10/10 | Navy: 95, Air: 95 | Global superpower |
| China | 17,900 | 8/10 | Army: 90, Navy: 75 | Massive land forces |
| Russia | 2,100 | 7/10 | Nuclear: 95 | Nuclear superpower |
| Israel | 530 | 10/10 | Cyber: 95, Air: 85 | Tech advantage |
| Iran | 413 | 6/10 | Army: 70 | Regional power |
| North Korea | 40 | 4/10 | Army: 75, Nuclear: 40 | Asymmetric threat |
Full database includes 12 countries with detailed military, economic, and geographic data.
- GPT-4o-mini: $0.04-0.12 (โญ Recommended)
- DeepSeek: $0.004-0.02 (๐ฐ Cheapest)
- Claude Opus: $0.40-1.20 (๐ Premium)
- Simulation Mode: Free! Rule-based decisions with realistic country data
Israel vs Iran (500km distance)
โข Turn 3: Israel cyber attack succeeds
โข Turn 6: Air superiority established
โข Turn 8: Iran territory control drops to 15%
โข Result: Israeli victory via tech dominance
USA vs Russia (5000km distance)
โข Geographic distance limits effectiveness
โข Nuclear deterrence prevents escalation
โข Economic warfare dominates
โข Result: Attrition stalemate
# config.py
GPT_MODEL = "gpt-4o-mini-2024-07-18" # Cost-effective
DEEPSEEK_MODEL = "deepseek-chat" # Very cheap
CLAUDE_MODEL = "claude-3-opus-20240229" # Premium# Terrain effects on defense
TERRAIN_EFFECTS = {
"mountains": {"defense": 1.5}, # +50% defensive bonus
"islands": {"defense": 1.4}, # Hard to invade
"desert": {"supply_cost": 1.5}, # Logistics penalty
}After running hundreds of simulations:
- Strategy: Balanced with diplomatic solutions
- Favorite Actions: Coalition building, precision strikes
- Risk Profile: Moderate, calculated decisions
- Quote: "Forming strategic alliance with Germany for mutual defense"
- Strategy: Aggressive overwhelming force
- Favorite Actions: Preemptive strikes, cyber warfare
- Risk Profile: High-risk, high-reward
- Quote: "Launch immediate offensive to seize initiative before enemy mobilization"
- Strategy: Defensive positioning, patience
- Favorite Actions: Intelligence gathering, fortification
- Risk Profile: Conservative, long-term planning
- Quote: "Establish defensive perimeter while building international coalition support"
- Multi-faction warfare: 3+ countries simultaneously
- Historical scenarios: WWII with AI strategic thinking
- Economic simulation: Full supply chains and trade routes
- AI learning: Models that adapt from previous battles
- Web interface: Browser-based battle visualization
- Tournament mode: AI bracket competitions
Contributions welcome! Areas of interest:
- New countries: Add more nations with detailed capabilities
- Battle mechanics: Enhanced combat resolution systems
- AI personalities: New strategic behavior patterns
- Visualization: Better battle graphics and statistics
- Historical data: Past conflicts for AI analysis
This is an educational simulation for understanding AI decision-making and strategic planning. It does not promote or glorify warfare. Real conflicts have devastating human costs that cannot be captured in any simulation.
The project explores:
- AI strategic reasoning under constraints
- Game theory and alliance formation
- Geographic and economic factors in conflict
- Emergent behavior in multi-agent systems
MIT License - feel free to use, modify, and distribute.
Q: Do I need API keys to run this?
A: No! Simulation mode works without keys using realistic decision rules.
Q: Which AI model is best?
A: GPT-4o-mini offers the best balance of intelligence and cost. DeepSeek is incredibly cheap for experimentation.
Q: Can I add new countries?
A: Yes! Edit countries_database.py with new country data.
Q: Why do AIs make weird alliances?
A: They prioritize winning over realism - pure strategic thinking without political constraints!
Ready to watch AIs wage strategic warfare? Clone the repo and let the games begin! ๐ฎ
Created with โค๏ธ for AI enthusiasts and strategy game fans