cardgame, for now, provides two games engines : war game and "belote contrée".
It allows me to practice multiple programming skills :
- implements more complex things that you usually code in a web business app.
- apply multithreading concepts learned by reading but rarely practiced.
War game was just a warm-up. The final objective of the project is a try to provide a contree game with a modern dynamic GUI.
Java 21 is required. I suggest to install the JDK with SdkMan.
./mvnw -Pstandalone clean package
Activating the "standalone" profile is needed if you want to play the game in console mode.
If you want to use cardgame as a jar lib, do not use "standalone" profile.
You can play a contree game in text mode with 3 (stupid) bots who never bid by running this command :
java -jar target/cardgame-*-standalone.jar
java -jar target/cardgame-*-standalone.jar --only-bots=true
Default score to reach to end a game is 1500. You can change the max score with the "--max-score" option :
java -jar target/cardgame-*-standalone.jar --max-score=500
It is possible to generate a native image of cardgame. The pom.xml file contains all needed configuration. You need to install GraalVM. I suggest installing a 'Liberica NIK' java 21 graalvm using sdkman. Example:
sdk install java 23.1.4.r21-nik # latest version while updating the README
Then, build the project with this command:
./mvnw -Pstandalone,native package
You'll find the native image at target/cardgame
You can "install" contree-game on your linux system by running these commands (with the hypothesis that your HOME contains a bin directory that's in your PATH) :
rm -f $HOME/bin/contree-game
./mvnw -Pstandalone package
./scripts/jpackage.sh
ln -s $(pwd)/target/jpackage/contree-game/bin/contree-game $HOME/bin/contree-game
For further reference, please consider the following sections: