Stockfish's very distant and not so bright cousin
What is this?
This is a UCI chess engine. That means it is a program that can analyse chess positions and propose best moves. The program does not have its own UI, but rather it implements the text based Universal Chess Interface (UCI), which makes it usable in most modern chess applications. This includes a live version of Goldfish that you can play on lichess.org.
Why is this?
This is not, nor does it attempt to be, the best chess engine out there. It is was originally developed from scratch as a practice project for learning C++. The end vision at that point was to have a working chess engine with a UCI interface. In 2018 the engine was playable, and somewhat stable. However, it was bad. Really bad. At this point it was decided to abandon my initial work instead of trying to work around bad design decisions made by the former me.
The current version is based on fluxroot/pulse. Thanks a lot to the original author for his great work. Starting with this project meant a stable starting point, with all the rules sorted out, basic search in place and a test suite to make sure it all works as expected.
At this point, the newest version of Goldfish has been substantially revamped and improved in most aspects (see Road map).
For some reason, several top chess engines have names of different fish, e.g. Stockfish, Rybka and others. Goldfish are known for their very limited memory, and so it seemed only fitting for my somewhat limited program to be named this.
The current plan for the project is to improve the strength. The following is a non-exhaustive list of possibilities for future additions, including all features that have been added so far. The list is inspired in large part by this writeup.
- Making the engine playable on lichess.org
- Complete refactoring of base types
- Null move pruning
- Transposition table
- Syzygy endgame tablebases
- Check extensions
- Killer move heuristic
- Principal variation search
- Internal iterative deepening
- Aspiration window search (repealed by PR #27, needs tuning before reapplying)
- Futility pruning
- Delta pruning in quiescence search.
- Prune when no move can improve enough
- Prune captures that are insufficient to improve
- Staged move generation
- Better search algorithms, such as MTD-bi (?)
- More sophisticated static evaluation
- Extra considerations for passed pawns
- Piece square tables
- King safety
- Center control
- Rooks on the 7th rank
- Bishops on main diagonals
Each significant change will result in a new version of the engine (see releases). In the following you see a relative rating between the current versions, based on test matches played with a variety of (short) time controls. In this rating system, v1.0 is held at 2000 rating points, and the others are adjusted accordingly. This gives an impression of the relative improvements of the engine over time, but cannot be compared directly to any other rating systems (e.g. FIDE).
Detailed head-to-head statistics can be found here.
This is meant as a project to work on just for the fun of it. Contributions are very welcome if you feel like it.
The project is written in C++17. It can be built using CMake, which hopefully makes this as portable as possible. Recommend building in a separate directory:
$ mkdir build && cd build $ # If CMake fails to locate a suitably modern compiler, you select what to use explicitly. $ export CXX=g++-8 # Or some C++17 compliant compiler of choice. $ export CC=gcc-8 # If necessary, also specify the C compiler. $ cmake .. -DCMAKE_BUILD_TYPE=Release $ make
After the compiling is done you should have two executables in the build
unit_tests.x. The former is the interface to the
engine it self.
There are pre-compiled executables available for recent versions, available under Releases. These are handy if you simply want to run Goldfish locally on a Windows machine.
To build from source, the recommended approach is using
Cygwin. Download and run the
setup-x86_64.exe (64 bit) installer.
When you get to the
Select Packages part of the installation, make sure to
include the latest versions of these packages:
In order to see all available packages you might need to select
Full in the
View pull-down. You select packages by changing the field labeled
be the latest version available in the menu.
After this, you should be able to follow the steps above (you will not need to do
Although it is possible to use the text based interface directly, it's recommended to run this through a UCI compatible graphical user interface, such as Scid. Or better still, play on lichess.org.
After building the
goldfish.x executable, you can run it directly. The engine
speaks using the UCI protocol.