
Overview
Bagatur is one of the strongest Java chess engines in the world.
It runs both on Android and on desktop computers (including virtual machines with many CPU cores in the cloud):
- Desktop: a console program that speaks the UCI protocol. It plugs cleanly into any UCI-compatible chess GUI, such as Arena Chess GUI.
- Android: shipped as a standalone app with its own user interface, available through the Bagatur Chess Engine with GUI page. The Android sources are open and live in their own repository: Android_APK_ChessEngineBagatur.
If you like the project, please give it a star! :-)
Downloads (desktop)
- New versions are published as standard GitHub releases.
- Older versions are bundled in a legacy zip archive; inside the archive, all of them are under
/Downloads/Engine/.
Running it
Bagatur runs on every operating system with a Java platform:
- Android: install the Bagatur Chess Engine with GUI app.
- Windows: the distribution ships with
.exelaunchers. Steps:- Install any UCI-compatible GUI — the most popular one is Arena Chess GUI.
- Install a Java Runtime Environment (JRE) 17 or later (JRE, not JDK — the
.exelauncher requires the runtime). Get it from java.com. - Unpack the Bagatur distribution somewhere (Arena has an
engines/subfolder that works well). - Register the engine inside the GUI (refer to your GUI’s documentation if you have not done this before).
- e2-e4 and enjoy :-)
- Linux: the project root contains
.shlaunchers; just make sure Java 17 (or later) is on yourPATH.
UCI Options
SMP-only options
These apply only to the SMP (multi-core) version. On Windows it is started by Bagatur_64_2+_cores.exe or Bagatur_mcore.bat; on Linux by Bagatur_mcore.sh. SMP has been tested with up to 64 CPU cores / threads. There is a known JVM-related scaling limitation — more details in Search/SMP.scaling.issue.txt.
- SMP Threads (
spin, defaultlogical_processors/2, min1, maxlogical_processors/2): number of search threads. - CountTranspositionTables (
spin, default1, min1, maxSQRT(logical_processors/2)): number of transposition tables used by the SMP version. The default of1is best in most cases; raise it only for experiments. See Search/SMP.scaling.issue.txt.
Options available in both single-core and SMP
- Logging Policy (
combo, defaultsingle file, values:single file/multiple files/none): whether Bagatur writes log files describing its actions. - OwnBook (
check, defaulttrue): whether to use the bundled opening book under./data/w.oband./data/b.ob. The book is built from a few million PGN games played by grandmasters and engines over the past 20 years, filtered down to the most frequently played continuations. Opening-name detection is not yet supported but is on the backlog (and is already available in the Android version). - Ponder (
check, defaulttrue): whether to keep thinking on the opponent’s time. - MultiPV (
spin, default1, min1, max100): how many best lines to report —1shows only the best line, higher values report the top N. - SyzygyPath (
string, default./data/egtb): path to the Syzygy tablebase files. The full resolved path is printed in response to theucicommand. - SyzygyOnline: when
true, if a local tablebase probe fails (e.g. you only have 5-piece files but the position needs 7), the engine falls back to the lichess online tablebase athttp://tablebase.lichess.ovh/standard?fen=.... - Openning Mode (
combo, defaultmost played first, values:most played first/random intermediate/random full): effective only whenOwnBookistrue.most played firstpicks the statistically most popular book move for the current position.random fullpicks uniformly at random from all stored book moves for the position.random intermediateis the compromise: a random choice among the top 3 candidates. (The option label preserves the historical spelling.) - UCI_Chess960 (
check, defaultfalse):false= classic chess;true= Fischer Random Chess (both FRC and DFRC modes are supported). - MemoryUsagePercent (
spin, default73, min50, max90): a fine-tuning knob — leave it alone unless you know what you are doing. It controls how much of the available heap the engine targets, which keeps the JVM from spending too much time in Garbage Collection. - TranspositionTable (
check, defaulttrue): whether to use the Transposition Table. - EvalCache (
check, defaulttrue): whether to cache evaluation results. In the SMP build this cache is per thread. - SyzygyDTZCache (
check, defaulttrue): whether to cache Syzygy DTZ probe results. Per-thread in the SMP build.
Syzygy Endgame Tablebases
The Bagatur distribution bundles a subset of Syzygy tablebases under ./data/egtb/ — 22 of the most common endgames with up to 5 pieces. The SyzygyPath UCI option points there by default. Change it if you have a fuller or larger Syzygy set installed elsewhere.
NNUE (Efficiently Updatable Neural Network)
Since version 5.0, Bagatur uses NNUE as its evaluation function. The Java port lives in its own subproject — see NNUE/.
Elo Rating
A chess engine’s strength is measured in Elo.
According to CCRL 40/15, the latest official Elo ratings of every well-tested version (with more than 300 games at 40/15 time control) are listed on this page: CCRL — Bagatur family.
Special thanks to Graham Banks, who has put tremendous effort into testing Bagatur versions over the years!
The latest official Elo rating of Bagatur is ~3400 Elo.
Technical details — sub-component documentation
- Bitboard
- NNUE
- Search Algorithm
- Endgame Tablebases
- Machine Learning
- Opening API
- Opening Generator
- PGNProcessor
- UCITracker
When and how the Bagatur Chess Engine project started
The project started as a bet between me and one of my friends from my first two years at university — he liked to play chess, and I could not win a single game against him. Over time this made me restless, and eventually I promised him (we shook on it) that I would write a chess program that would beat him.
Luckily for me, no time frame was agreed on, and… years later, I won the bet! :-) The whole story is captured in this YouTube video: “How was the idea of Bagatur Chess Engine application born?”.
The first public, open-source version of Bagatur was released on 2011-02-27 and is still available here. The project itself, however, started about 10 years earlier — somewhere between 1999 and 2000. It went through many private, non-public versions until 2011 (I do not even have their history any more). The early versions were very weak: they would make 2-3 moves and then crash. I spent hours and days hunting bugs and trying to understand why things did not work.
At that time the internet was almost empty, and I had no idea that software like CuteChess or Arena even existed, nor that there was a UCI protocol — so I also wrote my own graphical user interface, in Java AWT and Swing. Chess programming exposes you to a wide range of programming disciplines.
I picked Java mostly because of my (limited) experience with it. It also helps that Java was rather modern and popular at the time — only a few years after its first release, the early days of the Java language and the Java ecosystem.
So, if you are planning to write a chess engine: better start early — it takes time to reach a stable version that can beat you. :-)
Contact the author
You can reach me on LinkedIn: Krasimir Topchiyski — or by email at k_topchiyski@yahoo.com.
Some personal thoughts
According to CCRL, there are fewer than ~500 chess engines in the world. That means there are not that many people genuinely interested in chess-engine programming. The author of a chess engine has typically to be interested not only in programming but also in chess itself — and willing to invest a lot of spare time without any incentive, just for fun and curiosity. For that reason, I am always happy to see new engines and new authors appear!
I cannot speak for other authors, but I would also recommend a small, well-measured dose of craziness. It helps. As you release version after version, each release aiming for a higher Elo, sometimes you get stuck — sometimes for months — and it starts to feel like banging your head against a wall. When I reach that state, I step away from Bagatur for a while and wait for inspiration to come back. Always remember: it should be for fun! :-)
Bagatur is powered by YourKit Java Profiler

This excellent tool is used to find and fix performance, scalability, and memory-allocation issues. YourKit supports open-source projects with innovative and intelligent tools for monitoring and profiling.
Bagatur flavours
The chess engine JFish uses Bagatur as its base and plugs in the Stockfish NNUE as its evaluation function. The goal is to have the strongest Java chess engine as a reference.
Revision history
The full release history is collected here.
Credits
Fortunately, I am not alone on this project — without the ideas, support, and help from many people and websites, Bagatur would not be what it is today. Many thanks to:
- My wife and my family, because every now and then I have been borrowing time from our leisure to work on this project.
- Serendipity — thanks to Shawn for explaining how he trained the NNUE network of the Serendipity chess engine, and for the reference Java code that handles the network.
- Desislava Chocheva, for her hospitality and willingness to help. Without her support the introductory video could not have happened.
- Ivo Zhekov, for motivating me to start this project and for accepting the challenge with such a strong opponent in front of the camera.
- Simeon Stoichkov, for his general support on chess topics in Bulgaria, and for providing the chess pieces and the chess clock used in the introductory video.
- Varna Sound, for their willingness to support us and to contribute with their great rap music.
- Iavor Stoimenov, for the endless discussions about chess topics and chess engines.
- Ivo Simeonov, for all the ideas, support, discussions, tests, and contributed source code (e.g. the initial version of pawn-structure evaluation, the C porting, and the
.exelauncher). - Graham Banks from the Computer Chess Rating Lists (CCRL) — see also CCRL 40/40 — for organising and broadcasting chess-engine tournaments over the internet for many years.
- Anton Mihailov, Aloril, and Kan from the Top Chess Engine Championship (TCEC), for their invitations to Bagatur and for its participation in chess-engine tournaments for many seasons. Special thanks to Aloril, who contributed a lot to the testing of Bagatur’s Symmetric Multiprocessing (SMP) version on a CentOS box with more than 100 CPU cores. Thanks a lot for your support whenever engine issues / bugs surfaced!
- Olivier Deville, for his great support during ChessWar XVII — open-aurec.com/chesswar.
- Zoran Sevarac, author of Neuroph and co-author of Deep Netts, for his great support with our experiments on Neural Networks and Machine Learning in Java.
- Roelof Berkepeis, for testing, for sharing his chess experience, and for the great ideas captured as issues on the Bagatur GitHub page.
- Sameer Sehrawala, for the latest logo and his general support.
- Dusan Stamenkovic (chessmosaic.com), for several earlier Bagatur logos.
- The Internet itself, for connecting us.
- The Open Source community!
- The MTD(f) algorithm — Bagatur’s parallel search is based on this idea.
- winrun4j, for the Windows executables.
- All UCI-compatible GUIs, and the UCI protocol itself.
- REBEL — a very helpful web page.
- The Glaurung chess engine, for nice ideas inside its evaluation function (e.g. king safety).
- Fruit, the legendary program with a beautifully clean and simple design.
- CuckooChess, one of the first Java chess engines.
- Chess22k, an exciting Java chess engine — strong and well written.
- The source code of the strongest open-source chess engine — Stockfish.
- SourceForge.
- GitHub.
- Stack Overflow.
- … and many others!