All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gameManager.h
Go to the documentation of this file.
1 /* gameManager.h
2  */
3 #ifndef GAMEPLAYING_GAMEMANAGER_H
4 #define GAMEPLAYING_GAMEMANAGER_H
5 #include "osl/misc/carray.h"
7 #include "osl/move.h"
8 #include <boost/scoped_ptr.hpp>
9 
10 namespace osl
11 {
12  class Sennichite;
13  namespace search
14  {
15  struct MoveWithComment;
16  }
17  namespace game_playing
18  {
19  class GameState;
20  class CsaLogger;
21  class ComputerPlayer;
22 
24  {
25  protected:
26  CArray<ComputerPlayer*,2> players;
27  CArray<bool,2> computers;
28  boost::scoped_ptr<GameState> state;
29  boost::scoped_ptr<CsaLogger> logger;
31  private:
32  int byoyomi;
33 
35  {
36  return players[turn];
37  }
38  public:
39  struct EndGame {};
45  virtual ~GameManager();
46  void load(const char *csa_filename, bool verbose=false);
47  void setTimeLeft(int black_time, int white_time);
48  void setByoyomi(int seconds) { byoyomi = seconds; }
49 
50  void resetLogger(CsaLogger *l);
51 
52  void setComputerPlayer(Player turn, bool is_computer);
53  bool isComputer(Player turn) const
54  {
55  return computers[turn] && player(turn);
56  }
57 
61  const search::MoveWithComment computeMove(int& consumed);
62  int eval(Player turn, Move m);
63  protected:
64  const Sennichite pushMove(const search::MoveWithComment&, int seconds);
65  void popMove();
66  };
67 
68  } // namespace game_playing
69 } // namespace osl
70 
71 #endif /* _GAMEMANAGER_H */
72 // ;;; Local Variables:
73 // ;;; mode:c++
74 // ;;; c-basic-offset:2
75 // ;;; End: