00001 /* gameState.h 00002 */ 00003 #ifndef _GAMESTATE_H 00004 #define _GAMESTATE_H 00005 00006 #include "osl/state/hashEffectState.h" 00007 #include <boost/scoped_ptr.hpp> 00008 #include <boost/shared_ptr.hpp> 00009 namespace osl 00010 { 00011 class Sennichite; 00012 class RepetitionCounter; 00013 namespace state 00014 { 00015 class SimpleState; 00016 } 00017 namespace container 00018 { 00019 class MoveStack; 00020 } 00021 namespace hash 00022 { 00023 class HashKeyStack; 00024 } 00025 namespace game_playing 00026 { 00030 class GameState 00031 { 00032 private: 00033 struct State; 00034 boost::scoped_ptr<State> stack; 00035 explicit GameState(const State& src); 00036 public: 00037 explicit GameState(const SimpleState& initial_state); 00038 ~GameState(); 00039 00040 enum MoveType { VALID, PAWN_DROP_FOUL, UNSAFE_KING, OTHER_INVALID }; 00041 MoveType isIllegal(Move m) const; 00042 const Sennichite pushMove(Move m); 00043 const Move popMove(); 00044 bool canPopMove() const; 00045 00046 const HashEffectState& state() const; 00047 const RepetitionCounter& counter() const; 00048 const container::MoveStack& moveHistory() const; 00049 const hash::HashKeyStack& hashHistory() const; 00050 int moves() const; 00051 int ply() const { return moves() / 2 + 1; } 00052 const SimpleState& getInitialState() const; 00053 00059 const boost::shared_ptr<GameState> clone() const; 00060 }; 00061 } // namespace game_playing 00062 } // namespace osl 00063 00064 #endif /* _GAMESTATE_H */ 00065 // ;;; Local Variables: 00066 // ;;; mode:c++ 00067 // ;;; c-basic-offset:2 00068 // ;;; End: