Bagatur

Java Chess Engine

View on GitHub

Bagatur logo

Overview

Bagatur chess engine is one of the strongest Java chess engines in the world.

It runs on Android as well as on “desktop” Computers (or even on virtual machine with many CPU cores into the Cloud):

If you like the project, please give it a star! :-)

Downloads for desktop computer

Running it

The program runs under all Operating Systems, which support Java platform:

UCI Options

Option available only for the SMP version of Bagatur. The SMP (multicore) version can be started by Bagatur_64_2+_cores.exe and Bagatur_mcore.bat for Windows and with Bagatur_mcore.sh under Linux. It is tested with up to 64 CPU cores and threads. There is known sclaing issues, caused by Java (more info here: https://github.com/bagaturchess/Bagatur/blob/master/Search/SMP.scaling.issue.txt).

All other options are available for both versions: single core and SMP.

Syzygy Endgame Tablebases

The download of Bagatur contains subset of syzygy tablebases placed under ./data/egtb/ directory. It contaiuns 22 of the most common endgames with up to 5 pieces. By default the option ‘SyzygyPath’ is set to this directory. You could change this UCI option if you have complete or bigger set of syzygy tablebases downloaded on your computer.

NNUE (Efficiently Updatable Neural Network)

Since version 5.0, Bagatur is using NNUE as evaluation function. There was a Java portings. More info: https://github.com/bagaturchess/Bagatur/tree/master/NNUE

Elo Rating

Chess strength and rating of a chess engine is measured in Elo. According to CCRL 40/15, the latest offical Elo ratings of all well tested version (with more than 300 games and time control 40/15), are available on this page: http://www.computerchess.org.uk/ccrl/4040/cgi/compare_engines.cgi?family=Bagatur

Special Thanks to Graham Banks, who put a huge efforts in testing Bagatur versions through the years!

Latest official Elo rating of Bagatur is ~3400 Elo.

More readings with technical details and explanations for each sub-component of Bagatur

When and how Bagatur Chess Engine project has started

The project has started as a bet between myself and one of my friends from my first 2 years in the University, who like to play chess. I was unable to win a single chess game against him! This made me nervous over the time and at the end I have promised him (we bet) that I will create a chess program, which will win a game against him! Fortunately the time frame was not mentioned during the bet and … years later I win it! :-) The whole story is captured in this youtube video “How was the idea of Bagatur Chess Engine application born?”: https://www.youtube.com/watch?v=_rNBxbUAbS0

The first public, open source version of Bagatur was available since 2011-02-27 here: https://sourceforge.net/projects/bagaturchess/files/BagaturEngine/older/ The project actually started ~10 years before this date. The actual start date was between 1999 and 2000. It had many proprietary non-public versions until 2011. I even don’t have history of them but they were quite weak in playing chess. First versions just succeeded to play 2-3 moves and then crashes. I have spend hours and days trying to fix the bugs and find out why it doesn’t work correctly. At this point in time, the internet was almost an empty space and I was not aware of softwares running chess engines like now CuteChess and Arena and I was not aware of the existence of the UCI protocol, so I also have created an own Graphical User Interface (GUI) based on Java AWT and Swing. Chess porgramming gives you diverse programming experiences … I have selected Java as a programming language, mainly because of my little (but existing) experience with it. I have to also admit that Java was quite modern and polular at this point in time. This was the time a few years after the first releases of the Java itself. The early ages of the Java language and Java technologies.

So, if you plan to work on a chess engine, better start earlier, you need time to achieve stable version which beats you! :-)

Contact the Author

In order to contact me, you could use LinkedIn Krasimir Topchiyski or email me at k_topchiyski@yahoo.com

Some personal toughts …

According to CCRL, there are below 500+ chess engines in the world. This means that not many people are really interested in programming chess engines. Most probably the author of a chess engine is interested not only in programming but also in chess game. He/she must have enough willingness to invest spare time in chess programing, without any incentives, just for fun and driven by curiosity.

Because of this fact, I am always happy to see new engines and new authors!

I don’t know for the other chess engine authors, but I would add small and well balanced portion of craziness … it helps in chess programming, while you release version after version, targeting better Elo strength of each new release, which actually happens in very rear cases and you cannot release a version long time. If this continues months, normally I feel it like “to bang your head against the wall”. When I reach this state, I exit Bagatur project for a while, awaiting for new inspiration and the muse. Always remember, it should be for fun! :-)

Bagatur is powered by YourKit Java Profiler

YourKit Logo

This nice tool is used to find out and fix performance, scalability and memory allocation isses. In general YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling.

Bagatur flavours

The chess engine <a href=https://github.com/bagaturchess/JFish>JFish</a> is using Bagatur as a basis and on top it uses the Stockfish NNUE as evaluation function. The idea behind is to have strongest chess engine in Java as a reference.

Revisions history

Packed in one place, the release history is available here

Credits

Fortunately, in this project I am not alone - without the ideas, support and help from many people and web sites, Bagatur would not be as it is now! Credits and many thanks to:

  1. My wife and my family, because every now and then I have been stealing from our leisure time to work on this project.
  2. https://github.com/xu-shawn/Serendipity, thanks to Shawn for explaining to me how he has trained the NNUE network of Serendipity chess engine as well as for the reference Java code, which handles the network.
  3. Desislava Chocheva, for her hospitality and willingness to help. Without her support this video couldn’t be a fact.
  4. Ivo Zhekov, for motivating me to start this project as well as for accepting the challenge with such a strong opponent in front of the camera.
  5. Simeon Stoichkov, for his general support, regarding chess topics in Bulgaria, as well as for the nice chess pieces and the chess clock, used in this video.
  6. Varna Sound, for their willingness to support us and to participate with their great RAP music.
  7. Iavor Stoimenov, for the endless discussions about Chess topics and Chess Engines.
  8. Ivo Simeonov, for all the ideas, support, discussions, tests and contributed source code (e.g. initial version of pawn structure evaluation, C porting, exe launcher).
  9. Graham Banks from Computer Chess Rating Lists (CCRL) website, https://ccrl.chessdom.com/ccrl/4040/ , https://www.computerchess.org.uk/ccrl/ , for all the chess engine tournaments he has been organizing and broadcasting over the Internet for many years as well.
  10. Anton Mihailov, Aloril and Kan from Top Chess Engine Championship (TCEC) website, https://tcec-chess.com/ , for their invitations for Bagatur and its participation in chess engines tournaments for many seasons. Special thanks to Alroil, who contributed a lot in the testing of Bagatur’s Symmetric MultiProcessing (SMP) version, which runs under CentOS on more than 100 CPU cores on the used hardware. Thanks a lot for the support in case of engine issues/bugs!
  11. Olivier Deville, for his great support during ChessWar XVII, http://www.open-aurec.com/chesswar/
  12. Zoran Sevarac, author of Neuroph and co-author of Deep Netts, for his great support with the experiments with Neural Networks and Machine Learning in Java.
  13. Roelof Berkepeis, for his testing, shared chess experience with me, and the great ideas described as issues on Bagatur’s page on github.com, https://github.com/bagaturchess/Bagatur/issues
  14. Sameer Sehrawala, for the latest logo and for his general support.
  15. Dusan Stamenkovic, http://www.chessmosaic.com/, for a few old Bagatur logos.
  16. Internet, Global Web, for connecting us.
  17. The Open Source Community!
  18. MTD(f), https://en.wikipedia.org/wiki/MTD(f) , the parallel search of Bagatur is based on this idea.
  19. winrun4j, http://winrun4j.sourceforge.net/ , for the windows executables.
  20. All UCI compatible GUIs and UCI protocol itself.
  21. REBEL, http://www.rebel13.nl/ , very helpful web page.
  22. Glaurung chess engine, nice ideas inside the evaluation function (e.g. king safety).
  23. Fruit, http://www.fruitchess.com/, legendary program, nice and simple design.
  24. ChuckooChess, https://github.com/sauce-code/cuckoo , one of the first Java chess engines.
  25. Chess22k, exciting java chess engine - strong and well written.
  26. The source code of the strongest open-source Chess Engine – Stockfish, https://stockfishchess.org/
  27. https://sourceforge.net/
  28. https://github.com/
  29. https://stackoverflow.com/
  30. … and many others!