Recently I was converting Piece types with and without color to enum classes to use as parameters and return values since I've found small bugs caused by mixing up the two in the past. This lead to me looking over my history update part that decreased the history score of played moves that weren't the best move :
Code: Select all
for (int i = 0; i < searchedQuietMoves.count; i++)
{
const ChessMove move = searchedQuietMoves.moves[i];
assert(!IsCapOrPromo(move, board));
if (move != bestMove) {
historyTable.AdjustMove(move, movedPiece, -deltaScore, prevOppMoveIdx, prevOwnMoveIdx );
}
}
I can't remember when I added this, it might have been originally added as far back as 1.4.
I had even added CaptureHistory in 2.1 (with same bug and no statistically significant elo gain.) Likewise I was never able to measure elo gain from history related LMR adjustments. So those were a couple clues.
I did previously gain 15 elo in 2.0 to 2.1 (measured with 8000 games) by deleting !isRoot from my LMR condition, but that wasn't a bug, more an assumption that PV focus and possibly missing alternative moves / tactics at root would be bad.
If anyone else has stories about surprisingly major bugs eventually found in a chess engine, feel free to share here.