Skip to content

Commit

Permalink
Use ttMove for stage QSEARCH_RECAPTURES
Browse files Browse the repository at this point in the history
  • Loading branch information
snicolet committed Mar 19, 2017
1 parent 352bd6f commit 212d42f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/movepick.cpp
Expand Up @@ -31,7 +31,7 @@ namespace {
PROBCUT, PROBCUT_INIT, PROBCUT_CAPTURES,
QSEARCH_WITH_CHECKS, QCAPTURES_1_INIT, QCAPTURES_1, QCHECKS,
QSEARCH_NO_CHECKS, QCAPTURES_2_INIT, QCAPTURES_2,
QSEARCH_RECAPTURES, QRECAPTURES
QSEARCH_RECAPTURES, QRECAPTURES_INIT, QRECAPTURES
};

// Our insertion sort, which is guaranteed to be stable, as it should be
Expand Down Expand Up @@ -97,7 +97,6 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, Square s)
{
stage = QSEARCH_RECAPTURES;
recaptureSquare = s;
return;
}

ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE;
Expand Down Expand Up @@ -182,7 +181,7 @@ Move MovePicker::next_move(bool skipQuiets) {
switch (stage) {

case MAIN_SEARCH: case EVASION: case QSEARCH_WITH_CHECKS:
case QSEARCH_NO_CHECKS: case PROBCUT:
case QSEARCH_NO_CHECKS: case QSEARCH_RECAPTURES: case PROBCUT:
++stage;
return ttMove;

Expand Down Expand Up @@ -326,7 +325,7 @@ Move MovePicker::next_move(bool skipQuiets) {
}
break;

case QSEARCH_RECAPTURES:
case QRECAPTURES_INIT:
cur = moves;
endMoves = generate<CAPTURES>(pos, cur);
score<CAPTURES>();
Expand All @@ -336,7 +335,8 @@ Move MovePicker::next_move(bool skipQuiets) {
while (cur < endMoves)
{
move = pick_best(cur++, endMoves);
if (to_sq(move) == recaptureSquare)
if ( move != ttMove
&& to_sq(move) == recaptureSquare)
return move;
}
break;
Expand Down

0 comments on commit 212d42f

Please sign in to comment.