Skip to content

Othello/Reversi game with AI strategies: Minimax, Alpha-Beta Pruning, and Monte Carlo. Built with JavaFX.

License

Notifications You must be signed in to change notification settings

ayoubdlf/Othello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Othello - AI Game in JavaFX

Welcome to Othello, a strategy game in Java developed with JavaFX. This project includes multiple game modes, a modern graphical interface, as well as an artificial intelligence capable of playing with different strategies: Minimax, Minimax with alpha-beta pruning, and Monte Carlo.

Othello Screenshot Othello Screenshot Othello Screenshot Othello Screenshot

Launch the game

Prerequisites

  • Java 17 or higher
  • JavaFX SDK 23.0.2 (or compatible version)
  • IDE (such as IntelliJ IDEA or VSCode) or command line

Important: The path to JavaFX is specific to each machine. Adapt the --module-path in the commands below.

Running the pre-built JAR

The easiest way to run the game is to download the pre-built Othello.jar from the GitHub Releases page.

Once downloaded, run the following command:

java --module-path /path/to/javafx-sdk-23.0.2/lib --add-modules javafx.controls,javafx.fxml -jar Othello.jar

Replace /path/to/javafx-sdk-23.0.2/lib with the actual path to your JavaFX SDK lib folder.

Execution via IntelliJ

  1. Download JavaFX and extract it on your machine.

  2. In IntelliJ:

    • Go to File > Project Structure > Libraries.
    • Click on the + button > Java.
    • Select the lib folder of the downloaded JavaFX SDK (e.g. /path/to/javafx-sdk-23.0.2/lib)
  3. Then, go to Run > Edit Configurations, and in VM options, add:

    --module-path /path/to/javafx-sdk-23.0.2/lib --add-modules javafx.controls,javafx.fxml

  4. Launch the MainIG.java class

How to play

Graphical interface (JavaFX)

When you launch the program, you will have 3 options:

Option Description
Human vs Human Two human players compete locally.
Human vs AI Choose the AI strategy (Minimax, Pruning, Monte Carlo) and its parameter.
AI vs AI Choose the strategies of both AIs for an automated simulation.

Game objective

  • Each player places a piece (black or white) on the board.
  • A valid move must flank one or more opponent pieces in a straight line (horizontal, vertical, or diagonal).
  • The captured opponent pieces are flipped.
  • The player with the most pieces at the end wins.

Game rules

  • The game is played on an 8x8 board.
  • Players take turns, the black player always starts.
  • A move is valid if it allows flanking one or more opponent pieces between the placed piece and another piece of the same color.
  • The flanked pieces are flipped to the active player's color.
  • If a player cannot make any valid move, they pass their turn.
  • If neither player can play, the game is over.
  • The player with the most pieces of their color on the board wins the game.

Available AI strategies

Strategy Description
Minimax Seeks to maximize its gain at a given depth.
Minimax Pruning Variant of Minimax with alpha-beta optimization.
Monte Carlo Simulates many random games to evaluate a move.

Authors

  • DELLOUFI Ayoub
  • TECCHIO Alban

About

Othello/Reversi game with AI strategies: Minimax, Alpha-Beta Pruning, and Monte Carlo. Built with JavaFX.

Topics

Resources

License

Stars

Watchers

Forks