Skip to content

Commit

Permalink
Tweak usage of correction history
Browse files Browse the repository at this point in the history
Instead of using linear formula use quadratic one. Maximum impact of
correction history is doubled this way, it breaks even with previous
formula on half of maximum value.

Passed STC:
https://tests.stockfishchess.org/tests/view/659591e579aa8af82b95d7e8
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 225216 W: 57616 L: 57019 D: 110581
Ptnml(0-2): 747, 26677, 57201, 27198, 785

Passed LTC:
https://tests.stockfishchess.org/tests/view/6596ee0b79aa8af82b95f08a
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 73314 W: 18524 L: 18125 D: 36665
Ptnml(0-2): 41, 8159, 19875, 8524, 58

closes #4967

Bench: 1464785
  • Loading branch information
Vizvezdenec authored and Disservin committed Jan 7, 2024
1 parent a5f7386 commit 6f9071c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,9 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo

Value newEval =
ss->staticEval
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)] / 32;
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)]
* std::abs(thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)])
/ 16384;

ss->staticEval = eval = to_static_eval(newEval);

Expand All @@ -759,7 +761,9 @@ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, boo

Value newEval =
ss->staticEval
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)] / 32;
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)]
* std::abs(thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)])
/ 16384;

ss->staticEval = eval = to_static_eval(newEval);

Expand Down Expand Up @@ -1502,7 +1506,10 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {

Value newEval =
ss->staticEval
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)] / 32;
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)]
* std::abs(
thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)])
/ 16384;

ss->staticEval = bestValue = to_static_eval(newEval);

Expand All @@ -1519,7 +1526,10 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {

Value newEval =
ss->staticEval
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)] / 32;
+ thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)]
* std::abs(
thisThread->correctionHistory[us][pawn_structure_index<Correction>(pos)])
/ 16384;

ss->staticEval = bestValue = to_static_eval(newEval);
}
Expand Down

0 comments on commit 6f9071c

Please sign in to comment.