- bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta)
+ 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;
+ }
+
+
+ // check_is_dangerous() tests if a checking move can be pruned in qsearch()
+
+ bool check_is_dangerous(Position& pos, Move move, Value futilityBase, Value beta)