- // value_from_tt() is the inverse of value_to_tt(): It adjusts a mate score
- // from the transposition table (where refers to the plies to mate/be mated
- // from current position) to "plies to mate/be mated from the root".
-
- Value value_from_tt(Value v, int ply) {
-
- return v == VALUE_NONE ? VALUE_NONE
- : v >= VALUE_MATE_IN_MAX_PLY ? v - ply
- : v <= VALUE_MATED_IN_MAX_PLY ? v + ply : v;
- }
-
-
- // 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));
+ // 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))
+ {
+ // Update occupancy as if the piece and the threat are moving
+ Bitboard occ = pos.pieces() ^ m1from ^ m1to ^ m2from;
+ Piece pc = pos.piece_on(m1from);