00001 //---------------------------------------------------------------------------- 00002 /** @file SpSimplePlayer.h 00003 Base class for simple Go playing algorithms. */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef SP_SIMPLEPLAYER_H 00007 #define SP_SIMPLEPLAYER_H 00008 00009 #include "GoBoard.h" 00010 #include "GoPlayer.h" 00011 00012 class SgTimeRecord; 00013 class SpMoveGenerator; 00014 class SpRandomMoveGenerator; 00015 00016 //---------------------------------------------------------------------------- 00017 00018 /** SimplePlayer has one move generator. 00019 It generates random moves if no other move is found. */ 00020 class SpSimplePlayer 00021 : public GoPlayer 00022 { 00023 public: 00024 virtual ~SpSimplePlayer(); 00025 00026 SgPoint GenMove(const SgTimeRecord& time, SgBlackWhite toPlay); 00027 00028 virtual int MoveValue(SgPoint p); 00029 00030 protected: 00031 SpSimplePlayer(const GoBoard& board, SpMoveGenerator* generator); 00032 00033 private: 00034 /** Move generator */ 00035 SpMoveGenerator* m_generator; 00036 00037 /** Use random generator if no other move found */ 00038 SpRandomMoveGenerator* m_randomGenerator; 00039 00040 /** Don't play on safe points */ 00041 virtual bool UseFilter() const 00042 { 00043 return true; 00044 } 00045 }; 00046 00047 //---------------------------------------------------------------------------- 00048 00049 #endif // SP_SIMPLEPLAYER_H 00050