Skip to content

A simple but relative strong Reversi bot running on botzone.org

Notifications You must be signed in to change notification settings

fffasttime/Reversi-bwcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reversi-bwcore

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.

Usage

requirements

  • 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.

build

  • Generate single file botzone program

    Run make botzone , it will call tools/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. See src/cui.cpp if it can't display properly.

  • Run keyboard interaction mode

    Run make test and test.exe, you can run bot by keyboard commands. And there are some commands for debug, see docs/TODO.md

    Specially, run test.exe -- will do some basic test

  • Match between two bots

    1. Get any Reversi bot supporting Botzone keep running mode, for bwcore1.5 is make online or make botzone
    2. Run make judger Make a Reversi judger, src/judger.cpp is a simple judger supports Botzone simplified interaction format
    3. Run python tools.py <bot1> <bot2> <n_games>, then result will be saved into match.log after all match games are finished
  • Generate selfplay data

    Run make gendata , board evaluation data can be generated by selfplay. Further more, you can modify src/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.

Tutorials

Waiting...

You can read docs/TODO.md for some details of this version

Old 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

About

A simple but relative strong Reversi bot running on botzone.org

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published