Simplify indexing

Removes 1 function (from_to) from the Move type, change them to simpler raw.
Remove the "and" use in the correction history structure calculation. Adjust
the indexing.

Passed simplification STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 42880 W: 11327 L: 11113 D: 20440
Ptnml(0-2): 161, 4852, 11212, 5042, 173
https://tests.stockfishchess.org/tests/view/690593b8ea4b268f1fac1e8a

Passed simplification LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 43560 W: 11276 L: 11079 D: 21205
Ptnml(0-2): 17, 4679, 12197, 4864, 23
https://tests.stockfishchess.org/tests/view/6906f819ea4b268f1fac216b

closes https://github.com/official-stockfish/Stockfish/pull/6391

Bench: 2523092
This commit is contained in:
AliceRoselia
2025-11-14 17:28:17 +01:00
committed by Joost VandeVondele
parent df88db16c6
commit 7b7a9485d6
4 changed files with 21 additions and 28 deletions
+6 -6
View File
@@ -824,7 +824,7 @@ Value Search::Worker::search(
if (((ss - 1)->currentMove).is_ok() && !(ss - 1)->inCheck && !priorCapture)
{
int evalDiff = std::clamp(-int((ss - 1)->staticEval + ss->staticEval), -200, 156) + 58;
mainHistory[~us][((ss - 1)->currentMove).from_to()] << evalDiff * 9;
mainHistory[~us][((ss - 1)->currentMove).raw()] << evalDiff * 9;
if (!ttHit && type_of(pos.piece_on(prevSq)) != PAWN
&& ((ss - 1)->currentMove).type_of() != PROMOTION)
pawnHistory[pawn_history_index(pos)][pos.piece_on(prevSq)][prevSq] << evalDiff * 14;
@@ -1066,7 +1066,7 @@ moves_loop: // When in check, search starts here
if (history < -4312 * depth)
continue;
history += 76 * mainHistory[us][move.from_to()] / 32;
history += 76 * mainHistory[us][move.raw()] / 32;
// (*Scaler): Generally, a lower divisor scales well
lmrDepth += history / 3220;
@@ -1196,7 +1196,7 @@ moves_loop: // When in check, search starts here
ss->statScore = 803 * int(PieceValue[pos.captured_piece()]) / 128
+ captureHistory[movedPiece][move.to_sq()][type_of(pos.captured_piece())];
else
ss->statScore = 2 * mainHistory[us][move.from_to()]
ss->statScore = 2 * mainHistory[us][move.raw()]
+ (*contHist[0])[movedPiece][move.to_sq()]
+ (*contHist[1])[movedPiece][move.to_sq()];
@@ -1414,7 +1414,7 @@ moves_loop: // When in check, search starts here
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq,
scaledBonus * 400 / 32768);
mainHistory[~us][((ss - 1)->currentMove).from_to()] << scaledBonus * 220 / 32768;
mainHistory[~us][((ss - 1)->currentMove).raw()] << scaledBonus * 220 / 32768;
if (type_of(pos.piece_on(prevSq)) != PAWN && ((ss - 1)->currentMove).type_of() != PROMOTION)
pawnHistory[pawn_history_index(pos)][pos.piece_on(prevSq)][prevSq]
@@ -1862,10 +1862,10 @@ void update_quiet_histories(
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus) {
Color us = pos.side_to_move();
workerThread.mainHistory[us][move.from_to()] << bonus; // Untuned to prevent duplicate effort
workerThread.mainHistory[us][move.raw()] << bonus; // Untuned to prevent duplicate effort
if (ss->ply < LOW_PLY_HISTORY_SIZE)
workerThread.lowPlyHistory[ss->ply][move.from_to()] << bonus * 761 / 1024;
workerThread.lowPlyHistory[ss->ply][move.raw()] << bonus * 761 / 1024;
update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus * 955 / 1024);