- case PH_GOOD_CAPTURES:
- assert(!pos.is_check());
- assert(movesPicked >= 0);
-
- while (movesPicked < numOfMoves)
- {
- bestIndex = find_best_index();
-
- if (bestIndex != -1) // Found a possibly good capture
- {
- move = moves[bestIndex].move;
- int seeValue = pos.see(move);
- if (seeValue < 0)
- {
- // Losing capture, move it to the badCaptures[] array
- assert(numOfBadCaptures < 63);
- moves[bestIndex].score = seeValue;
- badCaptures[numOfBadCaptures++] = moves[bestIndex];
- moves[bestIndex] = moves[--numOfMoves];
- continue;
- }
- moves[bestIndex] = moves[movesPicked++];
- if ( move != ttMove
- && move != mateKiller
- && pos.pl_move_is_legal(move, pinned))
- return move;
- }
- }
- break;