A feature-rich, GUI-based implementation of the popular card game Coup built in C++ using the SFML graphics library. This project recreates the strategic bluffing and deduction game with original character roles, each having unique abilities that affect gameplay dynamics.
Coup is a strategic card game for 2-6 players where participants take on different roles in a dystopian future, using influence and deception to eliminate opponents and be the last player standing. This implementation features:
- GUI-based gameplay using SFML for an intuitive gaming experience
- Six unique character roles with distinct abilities and gameplay mechanics
- Turn-based strategy with both basic and special actions
- Real-time interaction through a modern graphical interface
- Comprehensive testing suite ensuring robust game logic
The game includes six specialized roles, each with unique abilities:
- Governor - Enhanced taxation (3 coins instead of 2) and can undo other players' tax actions
- Spy - Intelligence gatherer who can reveal opponent coins and block arrest actions
- Baron - Investment specialist who can triple coins (pay 3, get 6) and receives compensation when sanctioned
- General - Can block coup attempts for 5 coins and has defensive capabilities
- Judge - Can block bribe actions and imposes penalties on attackers
- Merchant - Generates passive income and has alternative payment methods for penalties
- C++17 compatible compiler (g++ recommended)
- SFML 2.5+ graphics library
- GNU Make or CMake for building
- Linux/Windows/macOS (tested on Linux)
sudo apt update
sudo apt install build-essential libsfml-dev g++ makebrew install sfml gcc makevcpkg install sfml-
Clone the repository:
git clone https://github.com/Raz99/Coup-Game.git cd Coup-Game -
Build using Make:
make all
-
Alternative build commands:
make GUI # Build and run GUI application make Main # Build and run example demo make test # Build and run tests make valgrind # Valgrind - Memory check make clean # Clean - Remove all generated files
make GUI
# or directly:
./coup_gameThe game uses the included tahoma.ttf font located in the resources/ directory. Ensure this file is present for proper text rendering.
- Players: 2-6 participants
- Objective: Be the last active player remaining
- Starting conditions: Each player begins with 0 coins and is assigned a random role
- Victory condition: Eliminate all other players through strategic actions
Every player can perform these basic actions regardless of their role:
| Action | Cost | Regular Effect | Notes |
|---|---|---|---|
| Gather | Free | +1 coin | Can be blocked by sanctions |
| Tax | Free | +2 coins | Can be blocked by sanctions |
| Bribe | 4 coins | Extra turn | Allows additional action |
| Arrest | Free | Steal 1 coin from target | Cannot target same player twice consecutively |
| Sanction | 3 coins | Block target's economic actions | Prevents gather/tax until their next turn |
| Coup | 7 coins | Eliminate target player | Removes player from game |
- Mandatory Coup: Players with 10+ coins must perform a coup
- Reactive Abilities: Some role abilities can be used outside of turn order
- Economic Blocking: Sanctioned players cannot use gather or tax actions
- Launch the application
- Enter player names when prompted (2-6 players)
- Roles are automatically assigned randomly to players
- Game begins with the first player's turn
- Player cards display current coins, role, and status
- Action buttons show available moves for the current player
- Target selection appears when actions require choosing an opponent
- Message area provides feedback on actions and results
- Turn indicator highlights the active player
- Player Information Cards: Show name, role, coin count, and status
- Action Panel: Buttons for available actions (context-sensitive)
- Game Messages: Real-time feedback and action results
- Role-specific Buttons: Special abilities appear when applicable
- Governor: "Undo" button appears when someone uses tax
- Spy: "Spy On" for intelligence gathering
- Baron: "Invest" button for wealth multiplication
- General: "Block Coup" option when coup attempts occur
- Judge: "Block Bribe" when bribe actions are used
- Merchant: Automatic bonuses at turn start
- SFML Library: For graphics and windowing capabilities
- Doctest Framework: For unit testing infrastructure
- Original Coup Game: Created by Rikki Tahta
- Font: Tahoma typeface for UI text rendering
