]> git.sesse.net Git - stockfish/commitdiff
Alternative formula for dynamic contempt
authorceebo <chricainogithub@gmail.com>
Mon, 23 Apr 2018 07:13:07 +0000 (09:13 +0200)
committerStéphane Nicolet <cassio@free.fr>
Mon, 23 Apr 2018 07:13:27 +0000 (09:13 +0200)
Replace the formula involving arctan with something having similar
behaviour that can be implemented using integer-only operations.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 34781 W: 7189 L: 7093 D: 20499
http://tests.stockfishchess.org/tests/view/5ad7c95f0ebc595700526e76

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 39743 W: 5950 L: 5857 D: 27936
http://tests.stockfishchess.org/tests/view/5ad886ee0ebc595700526e9b

Closes https://github.com/official-stockfish/Stockfish/pull/1558

Bench: 5549801

src/search.cpp

index 15f870f5129c72916189a048d620825d3ace4c27..d7980bd7ab1d2ef23b7770e1344a7398a46d4c00 100644 (file)
@@ -379,7 +379,7 @@ void Thread::search() {
               beta  = std::min(previousScore + delta, VALUE_INFINITE);
 
               // Adjust contempt based on root move's previousScore (dynamic contempt)
               beta  = std::min(previousScore + delta, VALUE_INFINITE);
 
               // Adjust contempt based on root move's previousScore (dynamic contempt)
-              int dct = ct + int(std::round(48 * atan(float(previousScore) / 128)));
+              int dct = ct + 88 * previousScore / (abs(previousScore) + 200);
 
               contempt = (us == WHITE ?  make_score(dct, dct / 2)
                                       : -make_score(dct, dct / 2));
 
               contempt = (us == WHITE ?  make_score(dct, dct / 2)
                                       : -make_score(dct, dct / 2));