1 Star 1 Fork 0

Joker2770 / Z2I

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Z2I

MSBuild Codacy Badge

The pbrain-Z2I is just a gomoku engine which use the protocol of gomocup. A GUI named qpiskvork can load this engine.

Supported Games

Currently only Gomoku and similar games such as Tic-Tac-Toe.

Welcome other game implementions if you want to become the contributor!

Supported OS System

Linux/Windows (tested on Ubuntu 20 + GPU/CPU and Windows 10 + GPU/CPU)

Supported Enviroment

Both GPU and CPU (GPU test on Tesla V100 + Cuda 11 and CPU test on Intel i5/i7)

Language

C++ (for speed!) and python. The model is trained by pytorch (Python) and onnxruntime (C++, for selfplay), and inferenced by onnxruntime (C++).

Dependence

gcc (Linux) or visual studio 19 (windows)

cmake 3.13+

pytorch (tested on 1.11)

onnxruntime-gpu (tested on 1.11)

Installation

Download and install miniconda / python and pip install all the dependent packages such as pytorch

train.sh: convert /data/miniconda3/bin/python to python or python3 or your own python intepreter path

Download onnxruntime: https://github.com/microsoft/onnxruntime/releases/tag/v1.11.1

CMakefiles.txt: convert the onnxruntime path to your own path

git clone --recursive https://github.com/Joker2770/Z2I.git
# git submodule update --init --recursive
cd Z2I
mkdir build
cp ./scripts/*.sh ./build/
cd ./build
cmake ..    # (or 'cmake -A x64 ..')
cmake --build . --config Release   # (or open .sln file through visual Studio 19 and generate for win10)

or build with xmake toolchain(In this way, onnruntime-1.11.1 will be installed with xrepo).

git clone --recursive https://github.com/Joker2770/Z2I.git
# git submodule update --init --recursive
cd Z2I
mkdir build
cp ./scripts/*.sh ./build/
xmake config --mode=release
xmake

Train (Linux)

cd ./build/
bash train.sh
...

If you want to train the model on windows 10, convert train.sh to train.bat and change corresponding commands.

Human play with AI (inference)

  1. Run pbrain-Z2I, for example on Linux:
./pbrain-Z2I

There is a better way to run pbrain-Z2I with the GUI program named qpiskvork besides.

Increase or decrease num_mct_sims in config.toml (default 100) to increase the power or speed of AI.

  1. Run mcts_test, for example on Linux:
./mcts_test ./weights/1000.onnx 1

Here 1(or 0) = AI play with black(or white) pieces.

Increase or decrease NUM_MCT_SIMS in src/common.h (default 1600) to increase the power or speed of AI.

reference

  1. https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html
MIT License Copyright (c) 2022 Augustusmyc Copyright (c) 2023 Joker2770 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

The pbrain-Z2I is just a gomoku engine which use the protocal of gomocup. (最新权重在咸鱼有售) 展开 收起
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/Joker2770/Z2I.git
git@gitee.com:Joker2770/Z2I.git
Joker2770
Z2I
Z2I
main

搜索帮助