diff --git a/src/history.h b/src/history.h index bb226cc9..af256e90 100644 --- a/src/history.h +++ b/src/history.h @@ -26,7 +26,7 @@ #include "types.h" -#define QuietEntry(move) (&thread->history[thread->pos.stm][fromSq(move)][toSq(move)]) +#define QuietEntry(move) (&thread->history[ColorOf(piece(move))][fromSq(move)][toSq(move)]) #define PawnEntry(move) (&thread->pawnHistory[PawnStructure(&thread->pos)][piece(move)][toSq(move)]) #define NoisyEntry(move) (&thread->captureHistory[piece(move)][toSq(move)][PieceTypeOf(capturing(move))]) #define ContEntry(offset, move) (&(*(ss-offset)->continuation)[piece(move)][toSq(move)]) diff --git a/src/search.c b/src/search.c index 7f8983d3..a784edb5 100644 --- a/src/search.c +++ b/src/search.c @@ -350,6 +350,11 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth if (!isTerminal(ttScore) && TTScoreIsMoreInformative(ttBound, ttScore, eval)) eval = ttScore; + if (ss->ply > 1 && (ss-1)->move && !moveIsCapture((ss-1)->move)) { + int bonus = CLAMP(-10 * ((ss-1)->staticEval + ss->staticEval), -1024, 1024) + 512; + QuietHistoryUpdate((ss-1)->move, bonus); + } + // Improving if not in check, and current eval is higher than 2 plies ago bool improving = !inCheck && eval > (ss-2)->staticEval;