00001 //---------------------------------------------------------------------------- 00002 /** @file BookCheck.hpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef BOOKCHECK_HPP 00007 #define BOOKCHECK_HPP 00008 00009 #include "Book.hpp" 00010 00011 _BEGIN_BENZENE_NAMESPACE_ 00012 00013 //---------------------------------------------------------------------------- 00014 00015 /** Returns best move from book. */ 00016 class BookCheck 00017 { 00018 public: 00019 00020 BookCheck(boost::scoped_ptr<Book>& book); 00021 00022 ~BookCheck(); 00023 00024 /** Returns best move from the book. Returns INVALID_POINT of no 00025 book or position not found in book. */ 00026 HexPoint BestMove(const HexState& state); 00027 00028 /** Ignore nodes with counts below this. */ 00029 unsigned MinCount() const; 00030 00031 /** See MinCount() */ 00032 void SetMinCount(int count); 00033 00034 /** Weight used to choose best move. */ 00035 float CountWeight() const; 00036 00037 /** See CountWeight() */ 00038 void SetCountWeight(float factor); 00039 00040 private: 00041 boost::scoped_ptr<Book>& m_book; 00042 00043 /** See MinCount() */ 00044 unsigned m_minCount; 00045 00046 /** See CountWeight() */ 00047 float m_countWeight; 00048 }; 00049 00050 inline unsigned BookCheck::MinCount() const 00051 { 00052 return m_minCount; 00053 } 00054 00055 inline void BookCheck::SetMinCount(int count) 00056 { 00057 m_minCount = count; 00058 } 00059 00060 inline float BookCheck::CountWeight() const 00061 { 00062 return m_countWeight; 00063 } 00064 00065 inline void BookCheck::SetCountWeight(float weight) 00066 { 00067 m_countWeight= weight; 00068 } 00069 00070 //---------------------------------------------------------------------------- 00071 00072 _END_BENZENE_NAMESPACE_ 00073 00074 #endif // BOOKCHECK_HPP