Skip to content

thinkboosted/Gomoku

Repository files navigation

Gomoku AI Project

This project implements a Gomoku AI ("Brain") in C++ designed to communicate with the liskvork game manager. It also includes a Python visualizer for real-time game monitoring.

Project Structure

  • src/main.cpp: The C++ source code for your Gomoku AI.
  • Makefile: Used to build the C++ AI.
  • pbrain-gomoku-ai: The compiled executable of your AI.
  • liskvork-x86_64-linux-0.6.1: The liskvork game manager (pre-compiled binary).
  • config.ini: Configuration file for liskvork.
  • visualizer.py: A Python script to visualize the game in real-time.
  • requirements.txt: Lists Python dependencies (currently none beyond standard library).
  • board.log: Log file generated by liskvork containing game states.

Setup

Prerequisites

  • C++ Compiler: g++ (or compatible) for building the AI.
  • make: For using the Makefile.
  • Python 3: For running the visualizer. tkinter module (usually included with Python).

Building Your AI

Navigate to the project root and compile your C++ AI:

make re

This will create an executable named pbrain-gomoku-ai in the project root.

Configuring Liskvork

The config.ini file needs to be updated to tell liskvork where to find your AI. The provided setup assumes your AI executable (pbrain-gomoku-ai) is in the project root.

The path for player1 and player2 in config.ini should point to your compiled AI:

[player1]
path=./pbrain-gomoku-ai
[player2]
path=./pbrain-gomoku-ai

The board_color setting should be false for the visualizer to work correctly:

[log]
board_file=./board.log
board_color=false

These changes have already been applied by the AI.

Running the Game

To run a game between two instances of your AI using liskvork:

  1. Start liskvork (Manager): It's recommended to clear the board.log file before each new game to avoid mixing logs from different sessions.

    rm -f board.log && ./liskvork-x86_64-linux-0.6.1

    If liskvork-x86_64-linux-0.6.1 is not executable, run chmod +x ./liskvork-x86_64-linux-0.6.1 first.

  2. Start the Visualizer: In a separate terminal, navigate to the project root and run the Python visualizer:

    python3 visualizer.py

    The visualizer window will appear, displaying the game in real-time. You can use the "Live (Auto-follow)" checkbox to toggle between real-time updates and manual navigation through game history using the "Prev", "Next" buttons, or the slider.

Debugging Tips

  • The board.log file is continuously updated by liskvork.
  • Your C++ AI can send debug messages using std::cout << "DEBUG Your message" << std::endl;. These messages will appear in the terminal where liskvork is running.
  • Use the visualizer's replay features (Prev, Next, slider) to analyze specific moves or game states.

Next Step: Implementing the Minimax algorithm and evaluation function in src/main.cpp to make your AI smarter.

About

Gomokkk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors