private void score_evasions() { // Try good captures ordered by MVV/LVA, then non-captures if destination square // is not under attack, ordered by history value, then bad-captures and quiet // moves with a negative SEE. This last group is ordered by the SEE score. // Skip if we don't have at least two moves to order if (lastMovePos < 2) { return; } int seeScore; for (int idx = 0; idx < lastMovePos; idx++) { Move m = ms[idx].move; if ((seeScore = ((Position.PieceValueMidgame[pos.board[m & 0x3F]] >= Position.PieceValueMidgame[pos.board[((m >> 6) & 0x3F)]]) ? 1 : pos.see(m, false))) < 0) { ms[idx].score = seeScore - History.MaxValue; // Be sure we are at the bottom } else if (((pos.board[m & 0x3F] != PieceC.NO_PIECE) && !((m & (3 << 14)) == (3 << 14))) || ((m & (3 << 14)) == (2 << 14))) { ms[idx].score = Position.PieceValueMidgame[pos.board[(m & 0x3F)]] - (pos.board[((m >> 6) & 0x3F)] & 7) + History.MaxValue; } else { ms[idx].score = H.value(pos.board[((m >> 6) & 0x3F)], (m & 0x3F)); } } }