- // 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) {
-
- if (v >= VALUE_MATE_IN_MAX_PLY)
- return v + ply;
-
- if (v <= VALUE_MATED_IN_MAX_PLY)
- return v - ply;
-
- return 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) {
-
- if (v >= VALUE_MATE_IN_MAX_PLY)
- return v - ply;
-
- if (v <= VALUE_MATED_IN_MAX_PLY)
- return v + ply;
-
- return 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.
+ // prevents_threat() tests whether a move is able to defend against the so
+ // called threat move (the best move returned from a null search that fails
+ // low). In this case will not be pruned.