To test the simulation, run python3 main.py
. The default number of players in a game is configured to 3
.
That can be changed using the num_players
attribute in the main.py
file.
- Add challenge and blocking effects [DONE]
- Different player identities through prompt variations (riskier, safer, random)
- Block failure safety [DONE]
- Enforcing game rules which include enforcing coup once you have more than 10 coins, although that happens naturally.
- Making sure the agent understands the repercussion of challenging [DONE]
- Add challenges, blocks and card losses to history
Steps used for creating an agent capable of playing the game "Coup." The agent will be able to:
- Play valid moves.
- Challenge other players' moves.
- Challenge blocks.
- Drop cards smartly.
Coup is a game of deception and strategy where players aim to eliminate each other's influence until only one player remains. The game includes:
- Characters (Influences): Duke, Assassin, Captain, Ambassador, and Contessa.
- Actions: Income, Foreign Aid, Coup, Tax, Assassinate, Steal, Exchange.
- Counteractions: Blocking Foreign Aid, Blocking Assassination (Contessa), Blocking Stealing (Captain or Ambassador).
- BeginTurn: The current player performs an action.
- ChallengeAction: Other players may challenge the action.
- BlockAction: The targeted player may block the action.
- ChallengeBlock: Other players may challenge the block.
- Early Game: Collect coins (Income or Foreign Aid) to avoid drawing attention.
- Mid Game: Use character-specific actions to gain an advantage.
- Late Game: Prepare for Coups by collecting coins or eliminating threats.
- Determine Action Priority: Based on the number of coins and the cards in hand.
- Assess Risk: Consider the likelihood of being challenged or blocked.
- Select Action: Choose the action that maximizes advantage and minimizes risk.
- Bluff Detection: Analyze the history of moves and revealed cards to detect possible bluffs.
- Risk Assessment: Weigh the risk of losing an influence against the potential benefit of removing an opponent's influence.
- Analyze Move Legitimacy: Check the probability that the opponent has the claimed card.
- Evaluate Risk vs. Reward: Decide whether the potential reward of a successful challenge outweighs the risk.
- Make Decision: Challenge if the move is highly suspicious and the risk is acceptable.
- Protect Resources: Block actions that directly harm the agent (e.g., Assassination, Stealing).
- Consider Challenge: Assess the likelihood of the block being challenged and the agent's ability to defend the challenge.
- Identify Blockable Actions: Determine if the agent has the necessary card to block.
- Assess Opponent’s Likelihood to Challenge: Consider the game state and opponent behavior.
- Decide to Block or Challenge: Block if it significantly benefits the agent, otherwise consider challenging the move instead.
- Card Value: Assess the strategic value of each card in hand.
- Current Game State: Consider the current game phase and the remaining opponents.
- Future Potential: Evaluate the potential future utility of each card.
- Rank Cards: Based on their utility in the current and future game state.
- Evaluate Risks: Consider which card’s loss would least impact the agent's strategy.
- Drop Card: Choose the card that is least valuable or most expendable.
- Check Coins: If the agent has 7 or more coins, prepare to Coup.
- Select Action: Based on early, mid, or late game strategy.
- Execute Action: Output the action in JSON format.
- Analyze History and Eliminated Cards: Determine the likelihood of a bluff.
- Weigh Risks and Rewards: Decide whether the potential gain is worth the risk.
- Make Decision: Challenge if the risk is acceptable.
- Check for Blockable Actions: Determine if the agent can block.
- Assess Risk of Challenge: Consider the likelihood and consequences of a challenge.
- Make Decision: Block or prepare to challenge if the action seems suspicious.
- Evaluate Card Utility: Rank the cards based on current and future game states.
- Drop Least Valuable Card: Choose the card with the least strategic value.