
//Introduction

ThothFish is a Stockfish derivative. Author is from Poland, the info shown from chess gui - "modified by An. Eg. Go" isn't a real name of author. It means Ancient Egyptian Gods and refers to name of derivative (Thoth - Egyptian god of wisdom and magic).


// Specific info

Version 1.21 is based on Stockfish development version from April 12 2019.


//Added Uci options:

	* DeepAnalysis - when checked - engine would disable some kinds of pruning, increase multipv and decrease reduction. It's enough to solve most hard/tacitc positions in relatively short time.

	* Pawn Exchange and next to Queen Exchange refer to engine tendency for exchanging pieces. For example very high value for Queen Ex. cause engine would try to exchange queens as soon as possible, usuelly before 20 moves of game. Low (negative) values cause that Thothfish sacrfice much only to keep piece on the chessboard as long as possible. Of course the more negative values in exchanging options the more close positions engine would prefer, high values bring open play and quick swaping of pieces. Contempt has possibilty to set in range from -2000 to 2000, it should be useful for compensate score too if You pick very high or very low values, with small changes don't have to care about contempt setting.

	* "Opening threshold", "Middlegame", "Endgame" are only starting point for options below them. 
Opening treshold means number of moves which should be consider as the end of opening phase (default 20 refers to moves from 1 to 20).
Middlegame means limit for next phase of game (more precisely it means limit for next moves after Op.Tr.), so if is set to 40 it refers to moves from 21 - 60 (60 not 40 because we add 40 to opening threshold). Endgame analogically, so when default is 60 it refers to moves from 61 - 120.

Some examples to make it more clear:
OT 5  									            (moves 1-5)
Mg 10 (for bottom limit add 1 to OT and add OT to Mg for upper limit)               (moves 6-15)
Eg 15 (for bottom limit add 1 to previous limit and add: OT+Mg+Eg for upper limit)  (moves 16-30)

OT 15   (moves 1-15)
Mg 30   (moves 16-45)
Eg 80   (moves 46-125)

OT 22    (moves 1-22)
Mg 50    (moves 23-72)
Eg 102   (moves 73-174)

Of course there are only names of options, it can be usable just for tuning opening phase, for example:
OT 6   (moves 1-6)
Mg 8   (moves 7-14)
Eg 6   (moves 15-20)

Remember that You can set first/first and second/all three phases of game. It won't work properly if You ignore opening threshold like this:

OT 0    (moves 0-0)
Mg 20   (moves 1-20)
Eg 14   (moves 21-34)

Anyway You can influence only for middlegame or endgame just by setting values with "MG" or "EG" (check below what they mean) and "OP" values leaving set to 0.

	
	* Contempt OP (opening phase), Contempt MG (for middlegame) and Contempt EG (yes, for endgame) allow to subtract or add some points to the basic contempt (range -200 to 200) and work only for appropriate phase of game. It means when You set, we can say (-20) for opening (and opening would be set to 15 limit) - it makes engine more defensive for first 15 moves but in 16 move its score will change (effect of contempt OP will disappear or - if set - will be changed to next contempt MG and so on).


 																		* Next 15 options - Pawn OP to Queen EG refer of course to set phases of game. Range -100 to 100 allows to add or subtract material worth of each piece. 1 point is more or less 1 percent (not exactly due to psqt tables and other things but it's easier to treat it this way). It's easy to guess that if only opening threshold is set then MG and EG values do nothing even if changed.

It works in different way than Exchange options. Exchange options tell engine that there is some loss or gain in specific exchanging/saving piece on chessboard, it directly affects score.  Changes in range Pawn OP to Queen EG aren't so noticeable at first in engine score output (so btw don't require compensate by contempt like exchange), tell engine rather that it should care less or more for picked piece in picked range of moves. 

Example: (-20) in Pawn OP makes engine to play more positional in opening, at the expense of pawns, so is more likely to pick some gambit lines with sacrifices of pawns like "B01 Scandinavian (centre counter) defence". 

Second example: High value in Knight MG (we can try 30) makes engine to searching (in middlegame) for lines where it saves its knights and "kill" opponent knight with exchanging for bishop for example. It works this way because engine assumes that not only its knights are worth more than bishops but opponent's knights too.

Generally negative values make engine more positional/tactic at the expense of material and opposite - higher positive values make it more materialistic and more blind for tactic and positional play. So it won't be surprise if effect of many higher values in material will bring position where engine has one or two pawns more (even as black) but its position will be scored negative and it ll be going to lose game.

* Own book and others below are of course for support opening books in .bin, it's a known solution from among others - Brainfish.

//Last words

There are 3 versions of compiled engine. Version popcnt for modern CPU, should work without problems on most computers nowadays.
Version bmi2 is a bit faster and usuelly needs Intel CPU. Last version - nopopcnt should work for some older machines.

In src folder are source files.

	ThothFish v. 1.21 isn't best option for people who looking for already tuned derivative which is slightly better than Stockfish, because with default options (exchange and material set to 0) it plays with the same strength as Stockfish. It's rather created for people who like looking for new ways to gain elo or change play style of engine by switching options on one’s own.

So there is no point (with default options) for testing it against other derivatives unless one's figure out which options and how much to change, then testing could be worthy and interesting.
