Gtsa
Game Tree Search Algorithms - C++ library for AI bot programming
Install / Use
/learn @AdamStelmaszczyk/GtsaREADME
Game Tree Search Algorithms

C++ library for AI bot programming.
Usage
- Specify game rules by subclassing
StateandMove. - Choose AI algorithm (
Minimax,MonteCarloTreeSearch), play by yourself (Human) or against external program (Executable). - Read the game state, pass it to the algorithm and output the move. For local, statistically significant tests, use
Tester.
Game examples
- Tic Tac Toe - game rules, code example.
- Isola - game rules, code example.
- Connect Four - game rules, code example.
- Go - game rules, code example.
Implemented algorithms
- NegaScout with iterative deepening and transposition table.
- Monte Carlo tree search with UCT and virtual visits.
Both handle sequential, multiplayer games:
<img src="https://github.com/AdamStelmaszczyk/gtsa/blob/master/cpp/examples/isola_four.gif"/></a></p>
MCTS also handles simultaneous games using SUCT.
Make commands
Execute below commands in the cpp directory.
makebuilds everything.make testruns unit tests.make valgrindruns valgrind's memory leak tests.make play_isolaplays as many games as needed to determine which Isola bot is better.
For all the commands check Makefile file.
Dependencies
- To build and run unit tests,
g++andlibboost-all-devpackages are needed. - To run valgrind,
valgrindpackage is needed. - To make GIFs,
imagemagickpackage is needed.
You can install all of them with sudo apt-get install g++ libboost-all-dev valgrind imagemagick.
Priorities of the library
- Correctness.
- Compliance with environment typical for competitions. One process. One file submission, compiled with one invocation of
g++. - Performance.
Would like to help?
Suggestions welcome on Issues. Pull requests too.
If you use code or ideas from this repository, please cite it as follows:
@misc{stelmaszczyk2015gtsa,
author = {Stelmaszczyk, Adam},
title = {Game Tree Search Algorithms},
year = {2015},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/AdamStelmaszczyk/gtsa}},
}
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
