00001 /* fixedEval.h 00002 */ 00003 #ifndef SEARCH_FIXEDEVAL_H 00004 #define SEARCH_FIXEDEVAL_H 00005 00006 #include "osl/eval/evalTraits.h" 00007 00008 namespace osl 00009 { 00010 namespace search 00011 { 00012 class FixedEval 00013 { 00014 int draw_value; 00015 protected: 00016 ~FixedEval() {} 00017 public: 00018 FixedEval() : draw_value(0) 00019 { 00020 } 00021 void setDrawValue(int value) 00022 { 00023 draw_value = value; 00024 } 00025 int drawValue() const { return draw_value; } 00026 00031 static int winByFoul(Player P) 00032 { 00033 return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE); 00034 } 00039 static int winByLoop(Player P) 00040 { 00041 return winByFoul(P); 00042 } 00046 static int winByCheckmate(Player P) 00047 { 00048 return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE-2); 00049 } 00053 static int minusInfty(Player P) 00054 { 00055 return winByCheckmate(alt(P)); 00056 } 00060 static int winThreshold(Player P) 00061 { 00062 return eval::convert(P, EvalTraits<BLACK>::MAX_VALUE-3); 00063 } 00067 static int windowMax(Player P) 00068 { 00069 return winByCheckmate(P); 00070 } 00076 static int brinkmatePenalty(Player P, int limit) 00077 { 00078 return (winByFoul(alt(P))*3/4+eval::convert(alt(P), limit*16)) & (~1); 00079 } 00084 static int threatmatePenalty(Player P) 00085 { 00086 return winByFoul(alt(P))/2; 00087 } 00091 static int isWinValue(Player P, int val) 00092 { 00093 return eval::notLessThan(P, val, winByCheckmate(P)); 00094 } 00095 }; 00096 } // namespace search 00097 } // namespace osl 00098 00099 #endif /* SEARCH_FIXEDEVAL_H */ 00100 // ;;; Local Variables: 00101 // ;;; mode:c++ 00102 // ;;; c-basic-offset:2 00103 // ;;; End: