Skip to content

sebastien-perpignane/cardgame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

What is cardgame ?

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.

How to build a playable jar

Java 17 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.

How to run contree games

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

You can run a "4 bots" game by activating the "--only-bots" option :

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

How to "install" contree game with a native image

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 17 graalvm using sdkman. Example:

sdk install java 22.3.5.r17-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

How to "install" contree game using jpackage

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

Reference Documentation

For further reference, please consider the following sections:

Technical doc

Card game doc