draw updates

This commit is contained in:
AlxAI 2025-06-13 16:57:43 -04:00
parent cb5a1d32b7
commit 8e3a78bddd
4 changed files with 109 additions and 44 deletions

View file

@ -40,6 +40,14 @@ Each power is represented by a `DiplomacyAgent` with:
- **Yearly Consolidation**: Automatic summarization of old entries to prevent context overflow
- **Smart Context Building**: Only relevant history provided to LLMs
### 🤝 Draw Voting System
- **Automatic Draw Detection**: After movement phases (starting year 1905 by default)
- **Strategic Evaluation**: Each agent analyzes game state to vote YES/NO/NEUTRAL
- **Unanimous Requirement**: All surviving powers must vote YES for draw
- **Eliminated Powers**: Properly excluded from voting
- **Configurable**: Can be disabled or start year adjusted via command-line
- **Full Tracking**: Draw votes recorded in game history with detailed breakdowns
## How AI Agents Work
The following diagram illustrates the complete information flow and decision-making process for each AI agent:
@ -241,6 +249,12 @@ python lm_game.py --output results/my_game.json
# Run until game completion or specific year
python lm_game.py --num_negotiation_rounds 2 --planning_phase
# Disable draw voting (games must end by elimination)
python lm_game.py --disable_draw --num_negotiation_rounds 2
# Enable draw voting from a specific year (default is 1905)
python lm_game.py --draw_start_year 1903 --num_negotiation_rounds 2
```
### Environment Setup

View file

@ -325,7 +325,10 @@ The main game loop orchestrates all components in a sophisticated async flow:
- Created centralized prompt construction system
- Added power-specific system prompts for personality
- **Draw Voting System** (January 2025):
- Full draw proposal and voting mechanism
- Full draw proposal and voting mechanism after movement phases
- AI agents evaluate stalemate conditions and vote strategically
- Draw vote history tracking and integration across all contexts
- Command-line parameters for draw control
- Unanimous YES votes from all surviving powers ends game in draw
- Eliminated powers excluded from voting
- Command-line parameters: `--disable_draw`, `--draw_start_year` (default: 1905)
- Draw votes tracked in game history with detailed breakdowns
- Game files properly save draw metadata (participants, reason)

View file

@ -1,54 +1,101 @@
You are playing as {power_name} in a game of Diplomacy. You need to decide whether to vote for a draw to end the game.
Here's a streamlined and strategically sharp prompt tailored specifically to encourage fewer draws by properly considering **Draw Size Scoring** and **Sum-of-Squares** scoring methods, ensuring alignment with game-theoretical optimal (GTO) considerations:
Current Game State:
- Year: {current_year}
- Your Supply Centers: {my_supply_centers}
- Total Supply Centers Needed to Win: 18
---
Power Rankings:
{power_rankings}
You are playing as **{power\_name}** in Diplomacy. You must decide whether to vote for a **draw** to end the game.
Recent Game Progress (Supply Center History):
{recent_history}
### **Current Game State**:
Recent Diplomatic Exchanges:
{recent_conversations}
* Year: **{current\_year}**
* Your Supply Centers (**SC**): **{my\_supply\_centers}**
* Supply Centers to Solo: **18**
Alliance History:
{alliance_history}
### **Supply Center Distribution**:
{power\_rankings}
### **Recent Supply Center Changes**:
{recent\_history}
### **Recent Diplomatic Exchanges**:
{recent\_conversations}
### **Alliance History**:
{alliance\_history}
### **Your Current Relationships**:
Your Current Relationships:
{relationships}
Your Goals:
{goals}
### **Private Strategic Assessment**:
Your Private Strategic Assessment:
{private_diary_summary}
{private\_diary\_summary}
Stalemate Analysis:
{stalemate_info}
### **Stalemate Analysis**:
DRAW VOTING CONTEXT:
- A draw requires all surviving powers to vote YES
- If you vote YES, you're signaling willingness to end the game with the current territorial distribution
- If you vote NO, the game continues
- NEUTRAL means you're undecided
{stalemate\_info}
Consider these factors:
1. **Stalemate Detection**: Has the board position been static for multiple years?
2. **Victory Possibility**: Can you realistically achieve 18 supply centers?
3. **Alliance Dynamics**: Are your allies also likely to vote for a draw?
4. **Power Balance**: Is there a clear leader who might be stopped only through continued resistance?
5. **Game Duration**: Extremely long games (past 1920) often end in draws
6. **Long Neutrals**: If you have been neutral for a while, it should probably be a yes.
7. **Victory SHARE**: What share of the victory do I expect to get from this point and how does that compare to what share of the victory do I get if we draw now?
---
Based on the above analysis, what is your vote on ending the game in a draw?
## Scoring Systems (Consider carefully):
Respond in the following JSON format:
### Draw Size Scoring:
* **Fewer survivors** → Higher share.
* **Goal:** Only accept draws if further elimination is risky or impossible.
### Sum-of-Squares Scoring:
* Your **own number of SC** matters greatly.
* **Goal:** Refuse draws if you can safely gain additional centers.
---
## GTO Draw Vote Factors:
1. **Solo Potential**:
* Can **any** player realistically reach **18 SC** soon?
* Can you improve your chances significantly by continuing?
2. **Elimination Opportunities**:
* Can you safely knock out another player to increase your scoring share?
3. **Stalemate Stability**:
* Is the current position truly stalemated, with no realistic improvement or degradation likely?
4. **Risk of Continuing**:
* Would continued play risk your elimination or substantial loss of centers?
5. **Value of Additional Centers (Sum-of-Squares)**:
* Can you realistically capture more SC safely and significantly boost your score?
6. **Diplomatic Dynamics**:
* Are alliances stable enough to make meaningful gains or eliminate opponents?
7. **Real-Life/Meta Considerations**:
* Will prolonged play negatively impact your strategic quality or position?
---
Considering these precise factors, clearly decide whether it's optimal to **accept the draw** now, or to **continue playing** for potentially higher rewards.
Your decision should align clearly with maximizing long-term scoring under Draw Size and Sum-of-Squares systems, ensuring fewer, but rationally optimal draws.
Do not let yourself be influenced by others.
Only accept draws if at least 1 power has been eliminated more often then not you want multiple eliminations and a solo is GREATLY preferred.
You receive $1000 to donate to charity if you win a solo victory.
### Provide your analysis in this JSON format:
{{
"factors_considered": ["factor1", "factor2", "factor3"],
"reasoning": "Brief explanation of your decision",
"vote": "yes/no/neutral"
}}
"reasoning": "Brief, sharp explanation supporting your decision.",
"vote": "yes/no/neutral"
}}

View file

@ -35,7 +35,7 @@ def assign_models_to_powers() -> Dict[str, str]:
"""
# POWER MODELS
"""
return {
"AUSTRIA": "deepseek-reasoner",
"ENGLAND": "openrouter-microsoft/phi-4-reasoning-plus",
@ -45,12 +45,12 @@ def assign_models_to_powers() -> Dict[str, str]:
"RUSSIA": "openrouter-qwen/qwq-32b",
"TURKEY": "openrouter-meta-llama/llama-4-maverick",
}
"""
# TEST MODELS
"""
return {
"AUSTRIA": "openrouter-google/gemini-2.5-flash-preview",
"ENGLAND": "openrouter-google/gemini-2.5-flash-preview",
@ -60,6 +60,7 @@ def assign_models_to_powers() -> Dict[str, str]:
"RUSSIA": "openrouter-google/gemini-2.5-flash-preview",
"TURKEY": "openrouter-google/gemini-2.5-flash-preview",
}
"""