00001 //---------------------------------------------------------------------------- 00002 /** @file SpRandomPlayer.h 00003 Random player */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef SP_RANDOMPLAYER_H 00007 #define SP_RANDOMPLAYER_H 00008 00009 #include "SpSimplePlayer.h" 00010 #include "SpMoveGenerator.h" 00011 #include "SgDebug.h" 00012 #include "SgWrite.h" 00013 00014 //---------------------------------------------------------------------------- 00015 00016 /** Plays random moves, but does not fill obvious 1-point eyes */ 00017 class SpRandomMoveGenerator 00018 : public SpStaticMoveGenerator 00019 { 00020 public: 00021 SpRandomMoveGenerator(const GoBoard& board) 00022 : SpStaticMoveGenerator(board) 00023 { } 00024 00025 virtual int Score(SgPoint p); 00026 }; 00027 00028 //---------------------------------------------------------------------------- 00029 00030 /** Simple player using SpRandomMoveGenerator */ 00031 class SpRandomPlayer 00032 : public SpSimplePlayer 00033 { 00034 public: 00035 SpRandomPlayer(const GoBoard& board) 00036 : SpSimplePlayer(board, new SpRandomMoveGenerator(board)) 00037 { } 00038 00039 std::string Name() const 00040 { 00041 return "Random"; 00042 } 00043 00044 protected: 00045 bool UseFilter() const 00046 { 00047 return false; 00048 } 00049 }; 00050 00051 //---------------------------------------------------------------------------- 00052 00053 #endif 00054