00001
00002
00003 #ifndef _NULLWINDOW_SEARCH_H
00004 #define _NULLWINDOW_SEARCH_H
00005
00006 #include "osl/search/searchFramework.h"
00007
00008 namespace osl
00009 {
00010 namespace search
00011 {
00022 template<typename Eval, typename MoveGenerator,
00023 typename Table,
00024 typename Recorder,
00025 typename Probabilities=RealizationProbability>
00026 class NullWindowSearch
00027 : public SearchFramework<Eval,MoveGenerator,Table,Recorder,Probabilities>
00028 {
00029 BOOST_CLASS_REQUIRE(Eval, osl::eval, Concept);
00030 typedef SearchFramework<Eval,MoveGenerator,Table,Recorder,
00031 Probabilities> framework_t;
00032 int black_lower_bound, black_upper_bound;
00033 protected:
00034 NullWindow null_window;
00035 public:
00036 const NullWindow nullWindow() const { return null_window; }
00037 explicit NullWindowSearch(const HashEffectState& s,
00038 typename framework_t::checkmate_t& checker,
00039 Table *t, Recorder& r);
00040 ~NullWindowSearch();
00041
00048 template <Player P>
00049 int nullWindowSearch(int threshold, const SearchMove& move,
00050 int limit);
00051 int nullWindowSearchOfTurn(int threshold, const SearchMove& move,
00052 int limit);
00053 void setRootBounds(Player root_turn, int lower, int upper)
00054 {
00055 if (root_turn == BLACK) {
00056 black_lower_bound = lower;
00057 black_upper_bound = upper;
00058 } else {
00059 black_lower_bound = upper;
00060 black_upper_bound = lower;
00061 }
00062 }
00063 int rootLowerBound(Player turn) const
00064 {
00065 if (turn == BLACK)
00066 return black_lower_bound;
00067 return black_upper_bound;
00068 }
00069 int rootUpperBound(Player turn) const
00070 {
00071 if (turn == BLACK)
00072 return black_upper_bound;
00073 return black_lower_bound;
00074 }
00084 template<Player P, bool best_move_extension>
00085 bool nullWindowSearch(const SearchMove& move,
00086 int& max_value, SearchMove& bestMove);
00098 template<Player P, bool best_move_extension>
00099 int nullWindowSearchAfterMove(const SearchMove& move, int base_value);
00100 private:
00101 template<Player P>
00102 int normalSearch(const SearchMove& moved, int logprob,
00103 int base_value, SearchMove& bestMove);
00104 };
00105 }
00106 using search::NullWindowSearch;
00107 }
00108
00109 #endif
00110
00111
00112
00113