00001 //---------------------------------------------------------------------------- 00002 /** @file PerfectPlayer.hpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef PERFECTPLAYER_HPP 00007 #define PERFECTPLAYER_HPP 00008 00009 #include "DfpnSolver.hpp" 00010 #include "HexBoard.hpp" 00011 #include "BenzenePlayer.hpp" 00012 00013 _BEGIN_BENZENE_NAMESPACE_ 00014 00015 //---------------------------------------------------------------------------- 00016 00017 /** Player using Solver to generate moves. Works best on boards 7x7 00018 and smaller. 00019 00020 @note This player is currently not used!! 00021 */ 00022 class PerfectPlayer : public BenzenePlayer 00023 { 00024 public: 00025 00026 explicit PerfectPlayer(DfpnSolver& solver, DfpnStates& positions); 00027 00028 virtual ~PerfectPlayer(); 00029 00030 /** Returns "perfect". */ 00031 std::string Name() const; 00032 00033 /** Maximum time to use per search. */ 00034 double MaxTime() const; 00035 00036 /** See MaxTime() */ 00037 void SetMaxTime(double time); 00038 00039 /** See DfpnSolver::PropagateBackwards(). */ 00040 bool PropagateBackwards() const; 00041 00042 /** See PropagateBackwards() */ 00043 void SetPropagateBackwards(bool flag); 00044 00045 private: 00046 DfpnSolver& m_solver; 00047 00048 DfpnStates& m_positions; 00049 00050 double m_maxTime; 00051 00052 bool m_propagateBackwards; 00053 00054 /** Generates a move in the given gamestate using DfpnSolver. */ 00055 HexPoint Search(const HexState& state, const Game& game, 00056 HexBoard& brd, const bitset_t& consider, 00057 double maxTime, double& score); 00058 }; 00059 00060 inline std::string PerfectPlayer::Name() const 00061 { 00062 return "perfect"; 00063 } 00064 00065 inline double PerfectPlayer::MaxTime() const 00066 { 00067 return m_maxTime; 00068 } 00069 00070 inline void PerfectPlayer::SetMaxTime(double time) 00071 { 00072 m_maxTime = time; 00073 } 00074 00075 inline bool PerfectPlayer::PropagateBackwards() const 00076 { 00077 return m_propagateBackwards; 00078 } 00079 00080 inline void PerfectPlayer::SetPropagateBackwards(bool flag) 00081 { 00082 m_propagateBackwards = flag; 00083 } 00084 00085 //---------------------------------------------------------------------------- 00086 00087 _END_BENZENE_NAMESPACE_ 00088 00089 #endif // PERFECTPLAYER_HPP