All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gameState.h
Go to the documentation of this file.
1 /* gameState.h
2  */
3 #ifndef OSL_GAMESTATE_H
4 #define OSL_GAMESTATE_H
5 
7 #include "osl/stl/vector.h"
8 #include <boost/scoped_ptr.hpp>
9 #include <boost/shared_ptr.hpp>
10 namespace osl
11 {
12  class Sennichite;
13  class RepetitionCounter;
14  namespace state
15  {
16  class SimpleState;
17  }
18  namespace container
19  {
20  class MoveStack;
21  class MoveVector;
22  }
23  namespace hash
24  {
25  class HashKeyStack;
26  }
27  namespace game_playing
28  {
32  class GameState
33  {
34  private:
35  struct State;
36  boost::scoped_ptr<State> stack;
37  explicit GameState(const State& src);
38  public:
39  explicit GameState(const SimpleState& initial_state);
40  ~GameState();
41 
43  MoveType isIllegal(Move m) const;
44  const Sennichite pushMove(Move m, int eval=0);
45  const Move popMove();
46  bool canPopMove() const;
47 
48  const NumEffectState& state() const;
49  const RepetitionCounter& counter() const;
50  const container::MoveStack& moveHistory() const;
51  const hash::HashKeyStack& hashHistory() const;
52  int moves() const;
53  int chessMoves() const { return moves() / 2 + 1; }
54  const SimpleState& getInitialState() const;
55 
61  const boost::shared_ptr<GameState> clone() const;
62 
63  const vector<int>& evalStack() const;
64  void generateNotLosingMoves(container::MoveVector& normal_or_win_or_draw,
65  container::MoveVector& loss) const;
66  void generateMoves(container::MoveVector& normal_moves,
68  container::MoveVector& draw,
69  container::MoveVector& loss) const;
70  bool rejectByStack(Move move) const;
71  };
72  } // namespace game_playing
73 } // namespace osl
74 
75 #endif /* OSL_GAMESTATE_H */
76 // ;;; Local Variables:
77 // ;;; mode:c++
78 // ;;; c-basic-offset:2
79 // ;;; End: