- // connected_moves() tests whether two moves are 'connected' in the sense
- // that the first move somehow made the second move possible (for instance
- // if the moving piece is the same in both moves). The first move is assumed
- // to be the move that was made to reach the current position, while the
- // second move is assumed to be a move from the current position.
-
- bool connected_moves(const Position& pos, Move m1, Move m2) {
-
- assert(is_ok(m1));
- assert(is_ok(m2));
-
- Square t1 = to_sq(m1);
- Square f1 = from_sq(m1);
- Square t2 = to_sq(m2);
- Square f2 = from_sq(m2);
-
- // The moving piece is the same or its destination square was vacated by m1
- if (t1 == f2 || t2 == f1)
- return true;
-
- // Moving through the vacated square
- if (piece_is_slider(pos.piece_on(f2)) && (between_bb(f2, t2) & f1))
- return true;
-
- // The destination square for m2 is defended by the moving piece in m1
- Bitboard t1_att = pos.attacks_from(pos.piece_on(t1), t1, pos.pieces() ^ f2);
- if (t1_att & t2)
- return true;
-
- // Discovered check, checking piece is the piece moved in m1
- Square ksq = pos.king_square(pos.side_to_move());
- if ((t1_att & ksq) && (between_bb(t1, ksq) & 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.
+ // refutes() tests whether a 'first' move is able to defend against a 'second'
+ // opponent's move. In this case will not be pruned. Normally the second move
+ // is the threat (the best move returned from a null search that fails low).