int searchTT = ttm;
ttMoves[0].move = ttm;
badCaptureThreshold = 0;
- lastBadCapture = badCaptures;
+ badCaptures = moves + MOVES_MAX;
pinned = p.pinned_pieces(pos.side_to_move());
phasePtr = MainSearchPhaseTable;
}
- else if (d == DEPTH_ZERO)
+ else if (d >= DEPTH_QS_CHECKS)
phasePtr = QsearchWithChecksPhaseTable;
else
{
return;
case PH_BAD_CAPTURES:
- // Bad captures SEE value is already calculated so just sort them
- // to get SEE move ordering.
+ // Bad captures SEE value is already calculated so just pick
+ // them in order to get SEE move ordering.
curMove = badCaptures;
- lastMove = lastBadCapture;
+ lastMove = moves + MOVES_MAX;
return;
case PH_EVASIONS:
if (seeValue >= badCaptureThreshold)
return move;
- // Losing capture, move it to the badCaptures[] array, note
+ // Losing capture, move it to the tail of the array, note
// that move has now been already checked for legality.
- assert(int(lastBadCapture - badCaptures) < 63);
- lastBadCapture->move = move;
- lastBadCapture->score = seeValue;
- lastBadCapture++;
+ (--badCaptures)->move = move;
+ badCaptures->score = seeValue;
}
break;
// Sort negative scored moves only when we get there
if (curMove == lastGoodNonCapture)
- insertion_sort(lastGoodNonCapture, lastMove);
+ insertion_sort<MoveStack>(lastGoodNonCapture, lastMove);
move = (curMove++)->move;
if ( move != ttMoves[0].move