Skip to content

kmg3821/renju-ai

Repository files navigation

renju

How to build

  1. mkdir build
  2. cd ./build
  3. cmake .. -DCMAKE_BUILD_TYPE=Release
  4. cmake --build . -j --config Release

Tested on the lastest version (in 27 Sep 2025) of Windows, Ubuntu, and Raspberry Pi OS.

Trouble shooting

  • If missing type specifier - int assumed. Note: C++ does not support default-int error occurs, refer to the solution at tensorflow/tensorflow#64376 (comment)
  • If undefined reference to 'xnn_something' error occurs, add -DTFLITE_ENABLE_XNNPACK=OFF to the cmake configuration.

How to play

Locate the following three files at the same directory:

  • renju executable (e.g. .exe)
  • renju.tflite
  • renju.html

Then,

  1. Run the renju executable
  2. Open localhost:8080 in the browser
  3. Play

Note

  • As of now, error handling is poor. The code contains minimal functionality.
  • The AI is not 100% perfect. It could make mistakes, placing strange moves.
  • The model defeated some online Gomoku programs :
    defeat2

How was it made

I used JAX ecosystem to create the AI model. The model is based on Alphazero. I made a big model first and distill it to a smaller one. Then, I converted it to tensorflow model. I'm going to upload the full training scripts later.