- // Threat gives a discovered check through the move's checking piece
- if (t1_att & pos.king_square(pos.side_to_move()))
- {
- assert(between_bb(t1, pos.king_square(pos.side_to_move())) & f2);
- return true;
- }
-
- return false;
- }
-
-
- // connected_threat() tests whether it is safe to forward prune a move or if
- // is somehow connected to the threat move returned by null search.
-
- bool connected_threat(const Position& pos, Move m, Move threat) {
-
- assert(is_ok(m));
- assert(is_ok(threat));
- assert(!pos.is_capture_or_promotion(m));
- assert(!pos.is_passed_pawn_push(m));
-
- Square mfrom = from_sq(m);
- Square mto = to_sq(m);
- Square tfrom = from_sq(threat);
- Square tto = to_sq(threat);
-
- // Case 1: Don't prune moves which move the threatened piece
- if (mfrom == tto)
- return true;
-
- // Case 2: If the threatened piece has value less than or equal to the
- // value of the threatening piece, don't prune moves which defend it.
- if ( pos.is_capture(threat)
- && ( PieceValue[MG][pos.piece_on(tfrom)] >= PieceValue[MG][pos.piece_on(tto)]
- || type_of(pos.piece_on(tfrom)) == KING))
+ // If the threatened piece has value less than or equal to the value of the
+ // threat piece, don't prune moves which defend it.
+ if ( pos.is_capture(second)
+ && ( PieceValue[MG][pos.piece_on(m2from)] >= PieceValue[MG][pos.piece_on(m2to)]
+ || type_of(pos.piece_on(m2from)) == KING))