Skip to content

Java Panama Project. JNI. The Tic-Tac-Toe 5x5 game is done on the java and c++. Full logic was done using the c++, all the graphical part was done on the java side.

Notifications You must be signed in to change notification settings

ovsidee/Checkers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

Checkers / Tic-Tac-Toe 5x5

A Checkers / Tic-Tac-Toe 5x5 game implemented as a Java Panama Project with JNI (Java Native Interface).

The game logic is implemented in C++, while the graphical interface is built using Java Swing. The design follows the MVC pattern to separate concerns between the model, view, and controller.

Technologies Used

  • Java Swing
  • C++
  • JNI
  • JUnit5

Game Flow

  1. Game Setup:

    • The game starts by initializing a 5x5 grid for the Tic-Tac-Toe board.
    • Players take turns to mark a cell in the grid with either "X" or "O".
  2. Gameplay:

    • The player or AI selects a cell to place their mark.
    • After each move, the game checks for a win condition (horizontal, vertical, diagonal).
  3. Win Condition:

    • A player wins if they form a line of 5 marks horizontally, vertically, or diagonally.
  4. Graphics:

    • The GUI updates dynamically after each move to reflect the state of the game.
    • Players are notified of wins or ties directly in the GUI.

Running the Application

To run the Checkers / Tic-Tac-Toe 5x5 game locally:

  1. Clone the repository:
    git clone https://github.com/your-username/CheckersTicTacToe5x5.git && cd CheckersTicTacToe5x5
  2. Compile the C++ code:
  • Make sure to compile the C++ game logic before running the application. If you are using a typical setup, use the following command:
    g++ -shared -o libgameLogic.so game_logic.cpp
  1. Run the Java application:
  • Build and run the project using Maven:
     mvn clean install
     mvn exec:java
  1. Play the game:
  • Launch the game through the GUI, and start playing!

Access the Game

  • The game interface is entirely graphical, offering click-able squares and updates for players to interact with the 5x5 board.

Unit Testing

Unit tests have been written to validate the core game logic, ensuring the correctness of game rules, win conditions, and turn-taking mechanisms. The tests are written using JUnit 5.

  • To run the tests:
mvn test

JNI Integration

The Java code communicates with the C++ logic through JNI. This allows Java to leverage the performance of C++ while maintaining a user-friendly interface in Java.

About

Java Panama Project. JNI. The Tic-Tac-Toe 5x5 game is done on the java and c++. Full logic was done using the c++, all the graphical part was done on the java side.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published