The idea is that we now use a linear formula like the following to decide on the contempt to use during a search :

contempt = x + y * eval

where x is the base contempt set by the user in the "Contempt" UCI option, and y * eval is the dynamic part which adapts itself to the estimation of the evaluation of the root position returned by the search. In this patch, we use x = 18 centipawns by default, and the y * eval correction can go from -20 centipawns if the root eval is less than -2.0 pawns, up to +20 centipawns when the root eval is more than 2.0 pawns.

To summarize, the new contempt goes from -0.02 to 0.38 pawns, depending if Stockfish is losing or winning, with an average value of 0.18 pawns by default.

Finally, we checked that there is no apparent problem with multithreading, despite the fact that some threads might have a slightly different contempt level that the main thread.

Match of this version against master, both using 5 threads, time control 30+0.3: ELO: 2.18 +-3.2 (95%) LOS: 90.8% Total: 14840 W: 2502 L: 2409 D: 9929 [You must be registered and logged in to see this link.]