Skip to content

Commit

Permalink
Use more continuation histories.
Browse files Browse the repository at this point in the history
This patch allows stats updates and movepicker bonuses for continuation history 3 plies deep - so counter counter move.
Updates and movepicker usage are done with 1/4 multiplier compared to other histories.

Passed STC:
https://tests.stockfishchess.org/tests/view/6528f28d3125598fc7ebb5a3
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 161344 W: 41369 L: 40868 D: 79107
Ptnml(0-2): 535, 18720, 41679, 19185, 553

Passed LTC:
https://tests.stockfishchess.org/tests/view/652a397a3125598fc7ebd1d6
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 48564 W: 12556 L: 12215 D: 23793
Ptnml(0-2): 25, 5149, 13595, 5486, 27

closes #4827

bench 1327410
  • Loading branch information
Vizvezdenec authored and vondele committed Oct 14, 2023
1 parent 0026363 commit 38e830a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/movepick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ void MovePicker::score() {
m.value = 2 * (*mainHistory)[pos.side_to_move()][from_to(m)];
m.value += 2 * (*continuationHistory[0])[pc][to];
m.value += (*continuationHistory[1])[pc][to];
m.value += (*continuationHistory[2])[pc][to] / 4;
m.value += (*continuationHistory[3])[pc][to];
m.value += (*continuationHistory[5])[pc][to];

Expand Down
8 changes: 4 additions & 4 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ namespace {
return probCutBeta;

const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
nullptr , (ss-4)->continuationHistory,
(ss-3)->continuationHistory, (ss-4)->continuationHistory,
nullptr , (ss-6)->continuationHistory };

Move countermove = prevSq != SQ_NONE ? thisThread->counterMoves[pos.piece_on(prevSq)][prevSq] : MOVE_NONE;
Expand Down Expand Up @@ -1511,7 +1511,7 @@ namespace {
}

const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
nullptr , (ss-4)->continuationHistory,
(ss-3)->continuationHistory, (ss-4)->continuationHistory,
nullptr , (ss-6)->continuationHistory };

// Initialize a MovePicker object for the current position, and prepare
Expand Down Expand Up @@ -1768,13 +1768,13 @@ namespace {

void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {

for (int i : {1, 2, 4, 6})
for (int i : {1, 2, 3, 4, 6})
{
// Only update the first 2 continuation histories if we are in check
if (ss->inCheck && i > 2)
break;
if (is_ok((ss-i)->currentMove))
(*(ss-i)->continuationHistory)[pc][to] << bonus;
(*(ss-i)->continuationHistory)[pc][to] << bonus / (1 + 3 * (i == 3));
}
}

Expand Down

1 comment on commit 38e830a

@yaneurao
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the change to for (int i : {1, 2, 3, 4, 6}), do we not need to modify the preceding comment to reflect -1, -2, -3, -4, and -6 in the following section?

// Updates histories of the move pairs formed
// by moves at ply -1, -2, -4, and -6 with current move.

Please sign in to comment.