Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SpRandomPlayer.h

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


17 Jun 2010 Doxygen 1.4.7