- // value_to_tt() adjusts a mate score from "plies to mate from the root" to
- // "plies to mate from the current position". Non-mate scores are unchanged.
- // The function is called before storing a value to the transposition table.
-
- Value value_to_tt(Value v, int ply) {
-
- assert(v != VALUE_NONE);
-
- return v >= VALUE_MATE_IN_MAX_PLY ? v + ply
- : v <= VALUE_MATED_IN_MAX_PLY ? v - ply : v;
- }
-
-
- // 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;
- }
+ // prevents_move() tests whether a move (first) is able to defend against an
+ // opponent's move (second). In this case will not be pruned. Normally the
+ // second move is the threat move (the best move returned from a null search
+ // that fails low).