All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fixedEval.h
Go to the documentation of this file.
1 /* fixedEval.h
2  */
3 #ifndef SEARCH_FIXEDEVAL_H
4 #define SEARCH_FIXEDEVAL_H
5 
6 #include "osl/eval/evalTraits.h"
7 
8 namespace osl
9 {
10  namespace search
11  {
12  class FixedEval
13  {
15  protected:
17  public:
19  {
20  }
21  void setDrawValue(int value)
22  {
23  draw_value = value;
24  }
25  int drawValue() const { return draw_value; }
26 
31  static int winByFoul(Player P)
32  {
33  return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE);
34  }
39  static int winByLoop(Player P)
40  {
41  return winByFoul(P);
42  }
46  static int winByCheckmate(Player P)
47  {
48  return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE-2);
49  }
53  static int minusInfty(Player P)
54  {
55  return winByCheckmate(alt(P));
56  }
60  static int winThreshold(Player P)
61  {
62  return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE-3);
63  }
67  static int windowMax(Player P)
68  {
69  return winByCheckmate(P);
70  }
76  static int brinkmatePenalty(Player P, int limit)
77  {
78  return (winByFoul(alt(P))*3/4+eval::convert(alt(P), limit*16)) & (~1);
79  }
84  static int threatmatePenalty(Player P)
85  {
86  return winByFoul(alt(P))/2;
87  }
91  static int isWinValue(Player P, int val)
92  {
93  return eval::notLessThan(P, val, winByCheckmate(P));
94  }
95  };
96  } // namespace search
97 } // namespace osl
98 
99 #endif /* SEARCH_FIXEDEVAL_H */
100 // ;;; Local Variables:
101 // ;;; mode:c++
102 // ;;; c-basic-offset:2
103 // ;;; End: