/Java-Solitaire

A Java game Solitaire, made with JavaFX

Primary LanguageJava

JavaFX Solitaire

A game of classic Solitaire (aka Klondike) made with JavaFX

Requirements

  • Java (JDK) 17 or higher.
  • Any graphics driver.

Quick Start

  1. Open this project in your IDE of choice, and Run as a normal Java app.
  2. Another option, is to your open Terminal / Powershell, go to this project's root directory and execute:
./gradlew run

Bonus: Building Native Installer

You can build a native installer, such as .msi for Windows, .dmg for MacOS, for JavaFX apps. The installer contains a slim JRE, your app, icons, and uninstaller. You can easily achieve that with jpackage tool, included in the JDK, since JDK 15! Learn more about jpackage tool. You'll need a few extra dependencies:

Windows

  • WiX Installer 3.0 or later, and added to PATH. Get it here

MacOS

  • Xcode
  • Apple Developer tools. Run this in Terminal
sudo xcode-select install

How to Build Native installer (1 command ONLY)

  • Simply run this command below in your terminal/ powershell, inside this project root directory.
./gradlew clean build jpackage
  • When done, you'll find the installer for your OS inside folder build/native/. Building for other OS requires that target OS. Cannot cross compile.

About the game

Works the same as classic desktop Solitaire. The first objective is to release and play into position certain cards to build up each foundation, in sequence and in suit, from the Ace through the King. The ultimate objective is to build the whole pack onto the foundations, and if that can be done, the Solitaire game is won. You can move multiples card at once, if they're sequential.

The rank of cards in Solitaire games is: K (high), Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2, A (low).