Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation


This is a C port of Stockfish.

Compiling Cfish

Compiling Cfish requires a working gcc or clang environment. The MSYS2 environment is recommended for compiling Cfish on Windows (see below on how to set up MSYS2).

To compile, type:

make target [ARCH=arch] [COMP=compiler] [COMPCC=gcc-4.8] [further options]

from the src directory. Lists of supported targets, archs and compilers can be viewed by typing make or make help.

If the ARCH variable is not set or is set to auto, the Makefile will attempt to determine and use the optimal settings for your system. If this fails with an error or gives unsatisfactory results, you should set the desired architecture manually.

Be aware that a Cfish binary compiled specifically for your machine may not work on other (older) machines. If the binary has to work on multiple machines, set ARCH to the architecture that corresponds to the oldest/least capable machine.

Further options:

nnue=noDo not include NNUE code
pure=yesNNUE pure only (no hybrid or classical mode)
sparse=yes/noEnable/disable NNUE sparse multiplication
numa=noDisable NUMA support
lto=yesCompile with link-time optimization
extra=yesCompile with extra optimization options (gcc-7.x and higher)

The sparse option selects between two different NNUE implementations. The option sparse=yes is likely superior (i.e. higher nps) for ARM-based CPUs, for Intel CPUs that do not support AVX2, and for AMD CPUs before Zen 3 (i.e. Ryzen 5000).

Add numa=no if compilation fails withnuma.h: No such file or directory or cannot find -lnuma.

The optimization options currently enabled with extra=yes appear to be less effective now that the NNUE code has been added.

UCI settings


A positive contempt value lets Cfish evaluate a position more favourably the more material is left on the board.

Analysis Contempt

By default, contempt is set to zero during analysis to ensure unbiased analysis. Set this option to White or Black to analyse with contempt for that side.


The number of CPU threads used for searching a position.


The size of the hash table in MB.

Clear Hash

Clear the hash table.


Let Cfish ponder its next move while the opponent is thinking.


Output the N best lines when searching. Leave at 1 for best performance.

Move Overhead

Compensation for network and GUI delay (in ms).

Slow Mover

Increase to make Cfish use more time, decrease to make Cfish use less time.


Path to the folders/directories storing the Syzygy tablebase files. Multiple directories are to be separated by ";" on Windows and by ":" on Unix-based operating systems. Do not use spaces around the ";" or ":".

Example: C:\tablebases\wdl345;C:\tablebases\wdl6;D:\tablebases\dtz345;D:\tablebases\dtz6


Minimum remaining search depth for which a position is probed. Increase this value to probe less aggressively.


Disable to let fifty-move rule draws detected by Syzygy tablebase probes count as wins or losses. This is useful for ICCF correspondence games.


Limit Syzygy tablebase probing to positions with at most this many pieces left (including kings and pawns).


Use Syzygy DTM tablebases (not yet released).


Control PolyGlot book usage.


Name of NNUE network file.


By default, Cfish uses NNUE in Stockfish's Hybrid mode, where certain positions are evaluated with the old handcrafted evaluation. Other modes are Pure (NNUE only) and Classical (handcrafted evaluation only).


Control allocation of the hash table as Large Pages (LP). On Windows this option does not appear if the operating system lacks LP support or if LP has not properly been set up.


This option only appears on NUMA machines, i.e. machines with two or more CPUs. If this option is set to "on" or "all", Cfish will spread its search threads over all nodes. If the option is set to "off", Cfish will ignore the NUMA architecture of the machine. On Linux, a subset of nodes may be specified on which to run the search threads (e.g. "0-1" or "0,1" to limit the search threads to nodes 0 and 1 out of nodes 0-3).

How to set up MSYS2

  1. Download and install MSYS2 from the MSYS2 website.
  2. Open an MSYS2 MinGW 64-bit terminal (e.g. via the Windows Start menu).
  3. Install the MinGW 64-bit toolchain by entering pacman -S mingw-w64-x86_64-toolchain.
  4. Close the MSYS2 MinGW 64-bit terminal and open another.