computerPlayer.h
Go to the documentation of this file.
00001 /* computerPlayer.h
00002  */
00003 #ifndef GAME_PLAYING_COMPUTERPLAYER_H
00004 #define GAME_PLAYING_COMPUTERPLAYER_H
00005 
00006 #include "osl/search/moveWithComment.h"
00007 #include "osl/state/numEffectState.h"
00008 #include "osl/move.h"
00009 #include "osl/misc/carray.h"
00010 #include <boost/scoped_ptr.hpp>
00011 namespace osl
00012 {
00013   namespace container 
00014   {
00015     class MoveVector;
00016   }
00017   namespace search
00018   {
00019     struct TimeAssigned;
00020   }
00021   namespace game_playing
00022   {
00023     class GameState;
00024     class ComputerPlayer
00025     {
00026     protected:
00027       bool speculative_search_allowed;
00028     public:
00029       ComputerPlayer() : speculative_search_allowed(false)
00030       {
00031       }
00032       virtual ~ComputerPlayer();
00034       virtual ComputerPlayer* clone() const = 0;
00035 
00036       virtual void pushMove(Move m)=0;
00037       virtual void popMove()=0;
00039       virtual bool isReasonableMove(const GameState&,
00040                                     Move move, int pawn_sacrifice);
00044       virtual const MoveWithComment selectBestMove(const GameState&, int seconds, int elapsed,
00045                                                 int byoyomi)=0;
00046 
00047       virtual void setInitialState(const NumEffectState&);
00051       virtual void allowSpeculativeSearch(bool value);
00053       virtual bool stopSearchNow();
00054 
00055       virtual void setRootIgnoreMoves(const container::MoveVector *rim, bool prediction);
00056     };
00057 
00058     class ComputerPlayerSelectBestMoveInTime
00059     {
00060     public:
00061       virtual ~ComputerPlayerSelectBestMoveInTime();
00062       virtual const MoveWithComment selectBestMoveInTime(const GameState&, const search::TimeAssigned&)=0;      
00063     };
00067     class ResignPlayer : public ComputerPlayer
00068     {
00069     public:
00070       ~ResignPlayer();
00071       ComputerPlayer* clone() const 
00072       {
00073         return new ResignPlayer();
00074       }
00075       void pushMove(Move m);
00076       void popMove();
00077       const MoveWithComment selectBestMove(const GameState&, int, int, int);
00078     };
00079 
00083     class RandomPlayer : public ComputerPlayer
00084     {
00085     public:
00086       ComputerPlayer* clone() const 
00087       {
00088         return new RandomPlayer();
00089       }
00090       ~RandomPlayer();
00091       void pushMove(Move m);
00092       void popMove();
00093       const MoveWithComment selectBestMove(const GameState&, int, int, int);
00094     };
00095 
00096   } // namespace game_playing
00097 } // namespace osl
00098 
00099 #endif /* GAME_PLAYING_COMPUTERPLAYER_H */
00100 // ;;; Local Variables:
00101 // ;;; mode:c++
00102 // ;;; c-basic-offset:2
00103 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines