else if (d == Depth(0))
phasePtr = QsearchWithChecksPhaseTable;
else
+ {
phasePtr = QsearchWithoutChecksPhaseTable;
+ // Skip TT move if is not a capture or a promotion, this avoids
+ // qsearch tree explosion due to a possible perpetual check or
+ // similar rare cases when TT table is full.
+ if (ttm != MOVE_NONE && !pos.move_is_capture_or_promotion(ttm))
+ searchTT = ttMoves[0].move = MOVE_NONE;
+ }
+
phasePtr += !searchTT - 1;
go_next_phase();
}
Move m;
Piece piece;
Square from, to;
- int hs;
for (MoveStack* cur = moves; cur != lastMove; cur++)
{
from = move_from(m);
to = move_to(m);
piece = pos.piece_on(from);
- hs = H.move_ordering_score(piece, to);
-
- // Ensure history is always preferred to pst
- if (hs > 0)
- hs += 1000;
-
- // pst based scoring
- cur->score = hs + mg_value(pos.pst_delta(piece, from, to));
+ cur->score = H.move_ordering_score(piece, to);
}
}
{
m = cur->move;
if ((seeScore = pos.see_sign(m)) < 0)
- cur->score = seeScore;
+ cur->score = seeScore - HistoryMax; // Be sure are at the bottom
else if (pos.move_is_capture(m))
cur->score = pos.midgame_value_of_piece_on(move_to(m))
- pos.type_of_piece_on(move_from(m)) + HistoryMax;