gameManager.h
Go to the documentation of this file.
00001 /* gameManager.h
00002  */
00003 #ifndef GAMEPLAYING_GAMEMANAGER_H
00004 #define GAMEPLAYING_GAMEMANAGER_H
00005 #include "osl/misc/carray.h"
00006 #include "osl/game_playing/timeKeeper.h" 
00007 #include "osl/move.h"
00008 #include <boost/scoped_ptr.hpp>
00009 
00010 namespace osl
00011 {
00012   class Sennichite;
00013   namespace search
00014   {
00015     struct MoveWithComment;    
00016   }
00017   namespace game_playing
00018   {
00019     class GameState;
00020     class CsaLogger;
00021     class ComputerPlayer;
00022     
00023     class GameManager
00024     {
00025     protected:
00026       CArray<ComputerPlayer*,2> players;
00027       CArray<bool,2> computers;
00028       boost::scoped_ptr<GameState> state;
00029       boost::scoped_ptr<CsaLogger> logger;
00030       TimeKeeper time_keeper;
00031     private:
00032       int byoyomi;
00033       
00034       ComputerPlayer *player(Player turn) const
00035       {
00036         return players[turn];
00037       }
00038     public:
00039       struct EndGame {};
00044       GameManager(ComputerPlayer *black, ComputerPlayer *white, CsaLogger *logger);
00045       virtual ~GameManager();
00046       void load(const char *csa_filename, bool verbose=false);
00047       void setTimeLeft(int black_time, int white_time);
00048       void setByoyomi(int seconds) { byoyomi = seconds; }
00049 
00050       void resetLogger(CsaLogger *l);
00051       
00052       void setComputerPlayer(Player turn, bool is_computer);
00053       bool isComputer(Player turn) const 
00054       {
00055         return computers[turn] && player(turn); 
00056       }
00057 
00061       const search::MoveWithComment computeMove(int& consumed);
00062       int eval(Player turn, Move m);
00063     protected:
00064       const Sennichite pushMove(const search::MoveWithComment&, int seconds);
00065       void popMove();
00066     };
00067 
00068   } // namespace game_playing
00069 } // namespace osl
00070 
00071 #endif /* _GAMEMANAGER_H */
00072 // ;;; Local Variables:
00073 // ;;; mode:c++
00074 // ;;; c-basic-offset:2
00075 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines