This repository contains a self-contained implementation of the bluffing card game Coup for the command line. The game follows the standard Coup ruleset (a copy of the official rule book is available in coup_rulebook.pdf) and supports multiple human players sharing a terminal.
- Complete turn loop covering income, foreign aid, coup, tax, assassination, steal, and exchange actions.
- Built-in handling for challenges, blocks, and forced coups when players accumulate 10 or more coins.
- Secret influence management, including helper utilities to reveal cards only to the active player.
- Randomized deck creation that mirrors the physical game components.
- Java Development Kit (JDK) 8 or newer.
Compile all sources from the project root:
javac *.javaThis produces the class files needed to run the game.
You may also download a prebuilt .jar file from the releases.
Running the packaged release is the preferred way to play the game and guarantees you are using the tested build that accompanies each version:
-
Visit the repository's Releases page and download the latest
coup-<version>.jarasset. -
From the download directory, launch the game with:
java -jar coup-<version>.jar
Replace
<version>with the version number of the downloaded release.
If you prefer to build the game yourself, you can also run it directly from the compiled sources: After compilation, launch the game with:
java GameFollow the on-screen prompts to enter player information and to select actions. Unless the prompt specifies otherwise, you can decline an optional action by submitting an empty input (press Enter).
Game.java– Orchestrates player setup, turn order, action resolution, and overall game flow.Player.java– Represents each participant, tracking coins and influences.Deck.javaandInfluence.java– Model the Coup deck and cards with helper utilities for random draws.SecretInfluenceViewer.java– Ensures only the acting player sees their cards or exchange options.ActionsPrinter.java– Centralizes instructional text and action menus printed to the terminal.StringToInt.java– Contains safe input parsing utilities used throughout the interactive prompts.coup_rulebook.pdf– Reference copy of the official Coup rules.
Issues and pull requests are welcome. If you plan to submit changes, please ensure the project still compiles (javac *.java) before opening a pull request.
This project is dedicated to the public domain under the CC0 1.0 Universal public-domain dedication. You can review the complete legal code on the Creative Commons website linked above.