## 1. Introduction

Cheese is a chess engine written in C++.

This program need a graphical interface to draw the chess board and select moves. The interface must be compatible with UCI or CECP protocol.

It's also possible to analyze positions in command line.

Executable for the latest version are available here :

- https://cheesechess.net/en/download.html

Source code is available here :

- https://gitlab.com/cheesechess/cheese

List of free compatible interfaces :

- Banksia GUI
- Scid vs. PC
- Lucas Chess
- ChessX
- Cute Chess
- En Croissant
- Chess for Android
- Arena
- Xboard
- Jose

## 2. Parameters and configuration

Parameters are in cheese.ini file that must be in the same folder as binary.

For parameters also available with UCI protocol, the values in cheese.ini are default values.

This file is loaded once at program launch.

- Hash

  (default = 256, minimum = 1, maximum = 65536)

  Memory (in Mb) used for main hashtable. The value must be a power of 2, or the program will use the nearest power of 2. In 32 bits the maximum value is 4096.

- Book

  (default = 0, value 0 or 1)

  Defines the use of an opening book (0 = no, 1 = yes)

- BookFile

  Path and name of the opening book in Polyglot format. If the path is not set the file must be at the same place as binary.

- UseStrength

  (default = 0, value = 0 or 1)

  Enable or disable use of strength reduction, defined in StrengthELO or EngineLevel parameter.

- StrengthELO

  (default = 3000, value between 800 and 3000)

  Define engine strength in ELO, if UseStrength = 1. ELO levels are based on CCRL 40/4 rating list.

- EngineLevel

  (by défaut = 23, value between 1 and 23)

  Replace StrengthELO parameter by a value between 1 and 23, 1 correspond to 800 ELO, and 23 to 3000 ELO.

  If EngineLevel is at maximum value, StrengthELO is used.

- UCILimitMode

  (default = 0, value 0 or 1)

  Set the method used to reduce engine strength. 0 reduce the speed and 1 reduce the number of nodes searched.

- UseNullMovePruning

  (default = 1, value 0 or 1)

  Defines the use of Null move pruning algorithm, disabled usually reduce engine strength by 100 ELO.

  Enabled, the engine might miss few important moves in Zugzwang type positions.

- UseLMR

  (default = 1, value 0 or 1)

  Defines the use of Late Move Reduction algorithm, disabled usually reduce engine strength by 100 ELO.

  Enabled, the engine might miss important moves.

- DrawScore

  (default = 0, values usually between -50 and 50)

  Contempt factor : this is the value used to represent draw positions by the engine, it must be near zero.

- MaxThreads

  (default = 1, value between 1 and the number of available CPU cores)

  Define the number of threads used by the search.

  The recommanded value is the number of real CPU cores available on the computer.

- SMPMode

  (default ybwc, value ybwc or lazy)

  Define algorithm used for multi-threading

  - ybwc = Young Brother Wait Concept
  - lazy = Lazy SMP (shared hash table)

  In the current version, YBWC can use only 64 threads and Lazy SMP 256 threads (on Windows the maximum number of threads is still limited to 64)

- MinSplitDepth

  (default 4, value between 4 and 8, or more)

  Minimum depth to reach before using YBWC algorithm.

- UsePersonality

  (default 0, value 0 or 1)

  Enable or disable the use of personalities in evaluation.

- PersonalityFile

  (default = personality/default.txt)

  Name of peronality file, if UsePersonality = 1

- LogLevel

  (default 31, value between 0 and 31)

  Output level for logs, it's a sum of multiple options :

  - 1 = information
  - 2 = warnings
  - 4 = errors
  - 8 = debug (disable in release version)
  - 16 = UCI or CECP protocols messages

  0 disable all, 31 enable all options.

  logfile.txt will be created in the same folder as binary.

- SyzygyPath

  (default <empty>)

  Path where Syzygy tables are located <empty> if not used.

- SyzygyProbeDepth

  (default 1)

  Minimum depth used to use tablebases.

- Syzygy50MoveRule

  (default 0, value 0 or 1)

  Use 50 moves rule with tablebases.

- SyzygyProbeLimit

  (default 7)

  Maximum number of pieces on the board to use tablebases.

## 3. Command line

- `cheese -help`

  Show all command line options available.

- `cheese -testsuite HASH_SIZE NB_THREADS {depth|time} VALUE FILENAME.epd`

  search all positions in filename.epd (support bm and am EPD options)

  - HASH_SIZE = hash table size (in Mb)
  - NB_THREADS = number of threads used for the search
  - depth VALUE = search limited by depth
  - time VALUE = search limited by time (seconds)
- `cheese -analyze -fen "FEN_STRING" [-hash HASH_SIZE] [-threads NB_THREADS] [-depth DEPTH] [-time TIME] [-nodes NODES] [-multipv MULTIPV] [-exclude MOVELIST] [-mate VALUE]`

  Analyee a position ad show results

  - FEN_STRING = FEN positiojn to analyze
  - HASH_SIZE = size of hash table
  - NB_THREADS = number of threads used
  - DEPTH = limit search depth
  - TIME = limit search time (seconds)
  - NODES = limit number of nodes searched
  - MULTIPV = number of variations searched
  - MOVELIST = list of moves to ignore (SAN format)
  - MATE = mate distance to find
- `cheese -perft DEPTH [-fen "FEN_STRING"]`

  count all possible legal moves until the specified depth

- `cheese -perftd DEPTH [-fen "FEN_STRING"]`

  detailed version of perft (show checks, mates, captures, and en-passant, promotions and castlings)

- `cheese -divide DEPTH [-fen "FEN_STRING"]`

  count all possible legal moves until the specified depth, for all moves in the position

- `cheese -benchmark HASH_SIZE NB_THREADS {depth|time} VALUE [FILENAME.epd]`

  run a benchmark using filename.epd, or using some default positions if file is not specified

- `cheese -probetb "FEN_STRING"`

  probe tablebases for the FEN position

- `cheese -probebook "FEN_STRING"`

  probe opening book for the FEN position

## 4. UCI Parameters

- Hash

  (default = 256, minimum = 1, maximum = 65536)

  Memory (in Mb) used for main hashtable. The value must be a power of 2, or the program will use the nearest power of 2. In 32 bits the maximum value is 4096.

- Ponder

  (defaut = false, true ou false

  Activate pondering, the engine is thinking while the opponent is playing.

- OwnBook

  (défault = false, value false or true)

  Set use of opening book

- Book

  Path and name of the opening book in Polyglot format. If the path is not set the file must be in the same place as binary.

- Clear

  Clear content of main hashtable.

- UsePersonality

  (default false, value false or true)

  Enable or disable the use of personalities in evaluation.

- PersonalityFile

  (default = personality/default.txt)

  Name of peronality file, if UsePersonality = true

- UCI_Chess960

  (default = false, value false or true)

  Enable or disable Chess960 or FRC support.

- MultiPV

  (default = 0, value between 0 and 32)

  Enable analysis of multiple possible moves for the current position, the results are sorted by score.

- NullMovePruning

  (default = true, value false or true)

  Enable or disable "Null move pruning" algorithm, disable it usually reduce engine strength by 100 ELO. Enabled, the search may miss some important moves in Zugzwang type positions.

- LateMoveReduction

  (default = true, value false or true)

  Enable or disable "Late Move Reduction" algorithm, disable it usually reduce engine strength by 100 ELO. Enabled, the search may miss some important moves.

- Threads

  (default = 1, value between 1 and number of available cpu cores

  Define the number of threads used by the search.

  The recommanded value is the number of real CPU cores available on the computer.

- SMPMode

  (default ybwc, value ybwc or lazy)

  Define algorithm used for multi-threading

  - ybwc = Young Brother Wait Concept
  - lazy = Lazy SMP (shared hash table)

  In the current version, YBWC can use only 64 threads and Lazy SMP 256 threads (on Windows the maximum number of threads is still limited to 64)

  YBWC seems faster under 8 threads.

- UCI_LimitStrength

  (default = false, value = false or true)

  Enable or disable use of strength reduction, defined by UCI_Elo or EngineLevel parameters.

- UCI_Elo

  (default = 3000, value between 800 and 3000)

  Define engine strength in ELO, if UCI_LimitStrength = true. ELO levels are based on CCRL 40/4 rating list.

- EngineLevel

  (default = 23, value between 1 and 23)

  Replace UCI_Elo to set engine level, if UCI_LimitStrength = true, 1 correspond to 800 ELO and 23 to 3000 ELO

  When EngineLevel is at maximum value, UCI_Elo is used to set engine ELO level

- LimitStrengthMode

  (default = speed, value speed or nodes)

  Set the method used to reduce engine strength. Reducing the speed or the number of nodes searched.

- DrawScore

  (default = 0, values usually between -50 et 50)

  Contempt factor : this is the value used to represent draw positions by the engine, it must be near zero.

- SyzygyPath

  (default <empty>)

  path where Syzygy tables are located <empty> if not used.

- SyzygyProbeDepth

  (default 1)

  minimum depth used to use tablebases.

- Syzygy50MoveRule

  (default false, valeur false ou true)

  Use 50 moves rule with tablebases.

- SyzygyProbeLimit

  (default 7)

  Maximum number of pieces on the board to use tablebases.

## 5. Personalities parameters

By default personalities are disabled, evaluation parameters were calculated automatiquement from millions of positions in games between different versions of the engine

To choose a personality you must edit cheese.ini and change UsePersonality=1 to use it, then choose the personality file, for example by default : PersonalityFile=personality/default.txt

The parameters of personality/default.txt are the same as default values without using personalities

If a parameter is not defined in the personality file, the default value is used.

Values of the following parameters are based on pawn material value, a pawn value is usually equal to 100, so if a parameter is equal 25 this means 1/4 of the value of a pawn

A positive value is an advantage and negative value a penality.

Parameters names ended by Mid are begining and middle game values, and paremeters names ended by End end game values.

- PawnValueMid, PawnValueEnd

  Material value of a pawn.

- KnightValueMid, KnightValueEnd

  Material value of a knight.

- BishopValueMid, BishopValueEnd

  Material value of a bishop.

- RookValueMid, RookValueEnd

  Material value of a rook.

- QueentValueMid, QueenValueEnd

  Material value of a queen.

- BishopPairMid, BishopPairEnd

  Bonus when a side has 2 bishops.

- PawnDoubledMid, PawnDoubledEnd

  Penality for doubled pawns.

- PawnIsolatedMid, PawnIsolatedEnd

  Penality of isolated pawns.

- PawnBackwardMid, PawnBackwardEnd

  Penality for backward pawns.

- RookOpenFileMid, RookOpenFileEnd

  Bonus for a rook on an open file.

- RookSemiOpenFileMid, RookSemiOpenFileEnd

  Bonus for a rook on a semi-open file.

- Rook7thRankMid, Rook7thRankEnd

  Bonuis for a rook on the 7th rank.

Following parameters are percentages (0..100) but can be bigger than 100.

- OutpostKnight

  Use of knight outpost.

- OutpostBishop

  Use of bishop outpost.

- PawnShield

  Use of pawn shield.

- PassedPawns

  Use of passed pawns.

Following parameters are ended by Own for the engine point of view, and Opp for the opponent point of view.

This is used to have asymetric values for evaluation, for the King protection it can be used to have a more or less aggressive personality, and for mobility it can give more importance to pieces developement.

- KingSafetyOwn

  Use of king safety from engine point of view.

- KingSafetyOpp

  Use of king safety from opponent point of view.

- MobilityOwn

  Use of pieces mobility from engine point of view.

- MobilityOpp

  Use of pieces mobility from opponent point of view.

- Randomness

  A random value is added to position evaluation, more or less important to reduce the strength of the engine.

Notes on previous versions :

Since version 3.1 material can be defined in middle and end game

Since version 3.2 isolated, doubled and backward pawns parameters are negatives.

Parameters OutpostKnight, PawnShield, PassedPawns are new since version 3.2