/gomoku_42

An IA capable of beating human players at Gomoku (42 project)

Primary LanguageGo

GOMOKU



Description

The goal of this project is to make an AI capable of beating human players at Gomoku with a 500ms constraint to play its turn. The IA of this project uses an alpha beta pruning algorythm with a homemade heuristic. The GUI is made with a golang library named Pixel (based on OpenGL).

Installation


Requirements: Golang version >= 1.13.0.

You must install the following dependencies : libasound2-dev, libgl1-mesa-dev and xorg-dev.

On Linux:


make linux-deps
make goget
make

You can now run gomoku. :)

On Windows:

You can use the precompiled executable in folder gomoku-W64-1.0.0.

or

Compile the project on WSL and use a tool like Xlaunch to be able to launch the project.

or

Compile the project on Mingw-w64 with:

make goget
make windows

(You still need to install the proper dependencies on Mingw-w64).

You can now run gomoku. :)

Parameters


-d or --depth <int> : Set the depth of the Alpha Beta pruning algo. (default: 5)
-w or --width <int> : Set the width of the Alpha Beta pruning algo. (default: 8)
-r or --routine : Disable go routine (Debug purpose).
-ia: An IA plays for you (Debug purpose)

Note: Default depth and width are a compromise between performance and efficiency. High values can lead to very a long computation time.

Rules:


  • To win you must put 5 stones in-a-row.

  • You can capture a pair of your ennemy stones. 5 captures lead to a win. If your 5-in-a-row is threatened with capture, you won't win. (Can be disabled on the main menu)

  • A double three is not allowed. (Can be disabled on the main menu)

  • You can choose a starting condition on the main menu.

  • Detailed rules in the subject: here

Controls


The game can completely be played with the mouse, but here are some shortcuts:
CTRL + Z: Undo
CTRL + R: Reset game
CTRL + H: Gives you a hint
CTRL + S: Save game (you can load it on the main menu)
CTRL + C: Show the potential captures on board (cheating is bad :) )
CTRL + V: Activate vsync
CTRL + F: Fullscreen mode
CTRL + A: Activate AA (smooth mode)

Screenshots

Main menu screenshot

Game screenshot

Grade

124/100