Skip to content

RobinMeneust/CY-Path

Repository files navigation

CY-Path

The Quoridor game in java

Description

CY-Path is a student game project developed in Java. It uses JavaFX for the graphics. Quoridor can be played by either 2 or 4 players.

Authors

  • BARRE Romain
  • ETRILLARD Yann
  • GARCIA-MEGEVAND Thibault
  • KUSMIDER David
  • MENEUST Robin

Important

  • Please note that CYPath.jar needs to be with the lib directory in target, or you need to specify the libraries location (look at the sections below) whereas CYPathStandalone.jar doesn't
  • The jar executables can be found in the GitHub action of this project (Continuous Integration) in the summary of a commit, in the artifacts section

Installation

  • Java must be installed (was tested on Java 19.0.2)
  • JavaFX must be installed (JDK version) (was tested on 17.0.7)
  • Maven is required to compile (was tested on 3.9.2)
  • org.json and json-simple are required for saving and loading files

Change 19 to your JDK version in pom.xml at the line : <java.version>19</java.version>

Change 17.0.7 to your JavaFX version in pom.xml at the line : <javafx.version>17.0.7</javafx.version>

Compile and generate jar executable

mvn clean prepare-package jar:jar package to create the executables .jar (CYPathStandalone has the .java of JavaFX classes inside it, but we still haven't checked if it's really standalone)

or just mvn clean prepare-package jar:jar to create the not standalone executable .jar

Execution

mvn clean javafx:run (use maven)

or

java --module-path LIB_PATH --add-modules MODULES -jar CYPath.jar and change LIB_PATH with the lib/ folder of javafx and the other requirements. And LIBRARIES with the modules names (javafx.controls, ...)

or java -jar target/CYPathStandalone.jar : it may not work since it's not made specifically for your system configuration

How to play

When you launch the application you can either press 'w' to open a JavaFX window or play in console mode by pressing 'c'.

In the JavaFX window

  • Navigate in the main menu to start a game (if a game is in progress there is a "Continue" button to go back to it)
  • Click on the button to change the mode (placing fence or moving)
  • Move mode :
    • The cells where you can move to are in a different color (in the color of your pawn)
    • Left-click on a cell to move there
  • Fence placing mode
    • Right-click on a cell to change the fence orientation
    • Move your mouse on a cell to display the current selected fence
    • If a fence is red it's not a valid position and if it's green it can be placed
    • Left-click on a cell to place the selected fence

In the console mode display

@ : represents a fence - : represents a cell border (without fence) 0, 1, 2, or 3 : represent the player (player 1, player 2, ...).

In this representation:

  • the top left cell is at (0,0)
  • the top right cell is at (8,0)
  • the bottom left cell is at (0,8)
  • the bottom right cell is at (8,8)

The cells coordinates are given on the left side and the top side of the board

To play you must write in the console your answer when a question is asked. We have the following questions/answers :

  • "Enter 'l' (load) to load a save file, and 'n' (new) to start a new game"
    • Type either l or n whether you want to load a save or create a new game
  • "How many players do you want ? (2 or 4)" (if you chose "new game")
    • Type either 2 or 4
  • "What is your next action ? ('m' (move) or 'f' (fence) or 's' (save))"
    • "m" : Move your pawn to the position that you will provide just after
    • "f" : Place a fence to the position that you will provide just after along with its orientation
    • "s" : Save your current game to a file in data/saves
  • "Where do you want to go ?"
    • Here, you can only move to the positions given in the list after "Those are the possible moves you can do"
    • "X" : Give a number between 0 and 8. It's the x (horizontal) coordinate of the position where tou want to move your pawn
    • "Y" : Give a number between 0 and 8. It's the y (vertical) coordinate of the position where you want to move your pawn
  • "What is the orientation of your fence ? (H(ORIZONTAL) or V(ERTICAL))" :
    • Press H if you want to place a horizontal fence
    • Press V if you want to place a vertical one
  • "Where do you want to put your fence ? (X,Y)"
    • "X" : Give a number between 0 and 8. It's the x (horizontal) coordinate of the position where tou want to move your fence
    • "Y" : Give a number between 0 and 8. It's the y (vertical) coordinate of the position where you want to move your pawn
    • Here we consider that (0,0) will place a fence going from (0,0) to (0,2) if it's vertical or (0,0) to (2,0) if it's horizontal. So the coordinates given here correspond to leftmost and uppermost point of the fence
  • If any of the given input are incorrect we ask the same question to the user over and over again
  • You can at the end of the game either restart or exit the program

Documentation

Use mvn javadoc:jar to generate the Javadoc in target/. Extract the jar archive and open index.html to read the documentation.

Clean generated binaries and files

To clean the target folder, use mvn clean