A built-from-scratch lichess-bot compatible chess engine made in C++
Table of Contents
Terconari is a built-from-scratch chess-bot/chess-engine made in C++ with a GUI built ontop of openFrameworks, compatible with lichess-bot, and often live and playable at lichess.org/Terconari.
- Lichess-style GUI for local-only BotvBot, PlayervBot (premove functionality), or PlayervPlayer usage
- GUI-free UCI mode for compatibility with lichess-bot
- Opening book functionality
- Default opening book has 244,117 games up to 16 plys deep, see Usage→Opening Book for more details
- Make/Unmake legal move verification
- Legal move generation tested against Stockfish's perft results across tens-of-millions of positions
- Evaluation via material/positional information
- Accounts for bishop pairs, passed pawns, and stacked pawns
- Uses modified Simplified Piece-Square Tables with a custom pawn-endgame table
- Negated Mini-Max with Alpha Beta Pruning
- Non-pawn captures are always calculated an additional depth
- Time-dependant Iterative Deepening
- Attempts a depth of 6 plys
- Escapes after
(timeLeft/50)+incrementseconds
- Null Move Pruning
- Does not run in positions that are in-check, have <= 4 legal moves, or have <= 6 total non-pawn pieces
An in-depth technical article about this project is coming soon to my website, nthorn.com
- Visit openFrameworks and download the Windows→Visual Studio version.
- Extract the downloaded zip to a directory of your choice.
- Clone/download the repository within your openFrameworks installation directory,
apps/myApps/cd apps/myApps git clone https://github.com/nTh0rn/chess-engine.git - Launch
Chess Engine.slnand confirm any refactoring prompts.
A starting screen GUI that allows for the modification of these settings is coming soon.
- Customize time control and gamemode by modifying class members within
/src/ofApp.h.
1.1.int gamemodevalues:0= Bot(w) v Bot(b),1= Player(w) v Bot(b),2= Bot(w) v Player(b),3= Player(w) v Player(b),4= UCI Mode (For lichess-bot).
1.2.int timeSecThe amount of time in seconds either side has.
1.3.int incrementThe amount of increment in seconds either side has. - Enable/disable debug messages by modifying
bool showDebugMessageswithin/include/Chess.h. - Run in Release mode without the local debugger for significant performance increase over Debug mode.
By default, Terconari comes with an opening book containing 244,115 games up to 16 plys deep obtained from PGNMentor and stripped of duplicates.
Custom opening books compatible with Terconari can be made using opening-book-PGN-to-UCI. Whichever opening book is to be used must be renamed to book.txt and placed within /bin/data/openingbooks/. See the function openingBookMove() within /lib/Chess.cpp if Terconari is unable to find its opening book.
After compiling, the contents of /bin/ can easily be moved to the /engines/ folder of lichess-bot per its documentation.
Distributed under the MIT License. See LICENSE.txt for more information.
Nikolas Thornton - nthorn.com - contact@nthorn.com
