A simple but relative strong Reversi (aka Othello) bot running on botzone.org
version: 1.5.2 ("strongbwcore" on botzone)
For detail introduction and rule of the game, see https://en.wikipedia.org/wiki/Reversi.
This project is writing for fun, and in memory of my first contact with programming.
The main algorithm of this bot is minimax search with alpha-beta pruning. Some famous optimization of minimax including PVS, hash table and zero window search are used. Bitwise operations are used to speed up board operation. Pattern evaluation is a important way to estimate on middle game. I tried to implement all of them by simple code, so it looks easier to read.
-
g++ >= 7
These code was developed under g++17. MinGW-w64 is suggested on Windows.
-
Python3
Some simple scripts including
tools/merge.py
tools/match.py
requires Python3. -
A modern x86-64 CPU
A little assembly instructions are used to speed up board operation.
-
Generate single file botzone program
Run
make botzone
, it will calltools/merge.py
to merge useful source files in/src
into botzone.cpp, and try to build it.make online
will build same program, but it is built by multiple files. -
Run a simple console UI (currently only available on Windows)
Run
make
, then there will be a bwcore1.5.exe. You can play game by clicking mouse. Seesrc/cui.cpp
if it can't display properly. -
Run keyboard interaction mode
Run
make test
andtest.exe
, you can run bot by keyboard commands. And there are some commands for debug, see docs/TODO.mdSpecially, run
test.exe --
will do some basic test -
Match between two bots
- Get any Reversi bot supporting Botzone keep running mode, for bwcore1.5 is
make online
ormake botzone
- Run
make judger
Make a Reversi judger,src/judger.cpp
is a simple judger supports Botzone simplified interaction format - Run
python tools.py <bot1> <bot2> <n_games>
, then result will be saved intomatch.log
after all match games are finished
- Get any Reversi bot supporting Botzone keep running mode, for bwcore1.5 is
-
Generate selfplay data
Run
make gendata
, board evaluation data can be generated by selfplay. Further more, you can modifysrc/gendata.cpp
to generate learning data as you like. -
Debug
When building all binaries above, add
make debug=1
to build with debug flag, then the code will not be optimized. bwcore1.5 will also do some assertion check when running under debug mode.
Waiting...
You can read docs/TODO.md for some details of this version
version: 1.4.x "impbwcore" (https://github.com/fffasttime/Reversi-bwcore/tree/1.4.x)
algorithm: minimax, ptn evaluation, ...
Got 1st place on botzone real time ranklist in 2017-2019, 3rd in 2020