gameState.h
Go to the documentation of this file.
00001 /* gameState.h
00002  */
00003 #ifndef OSL_GAMESTATE_H
00004 #define OSL_GAMESTATE_H
00005 
00006 #include "osl/state/numEffectState.h"
00007 #include "osl/stl/vector.h"
00008 #include <boost/scoped_ptr.hpp>
00009 #include <boost/shared_ptr.hpp>
00010 namespace osl
00011 {
00012   class Sennichite;
00013   class RepetitionCounter;
00014   namespace state
00015   {
00016     class SimpleState;
00017   }
00018   namespace container
00019   {
00020     class MoveStack;
00021     class MoveVector;
00022   }
00023   namespace hash
00024   {
00025     class HashKeyStack;
00026   }
00027   namespace game_playing
00028   {
00032     class GameState
00033     {
00034     private:
00035       struct State;
00036       boost::scoped_ptr<State> stack;
00037       explicit GameState(const State& src);
00038     public:
00039       explicit GameState(const SimpleState& initial_state);
00040       ~GameState();
00041 
00042       enum MoveType { VALID, PAWN_DROP_FOUL, UNSAFE_KING, OTHER_INVALID };
00043       MoveType isIllegal(Move m) const;
00044       const Sennichite pushMove(Move m, int eval=0);
00045       const Move popMove();
00046       bool canPopMove() const;
00047 
00048       const NumEffectState& state() const;
00049       const RepetitionCounter& counter() const;
00050       const container::MoveStack& moveHistory() const;
00051       const hash::HashKeyStack& hashHistory() const;
00052       int moves() const;
00053       int chessMoves() const { return moves() / 2 + 1; }
00054       const SimpleState& getInitialState() const;
00055 
00061       const boost::shared_ptr<GameState> clone() const;
00062 
00063       const vector<int>& evalStack() const;
00064       void generateNotLosingMoves(container::MoveVector& normal_or_win_or_draw, 
00065                                   container::MoveVector& loss) const;
00066       void generateMoves(container::MoveVector& normal_moves, 
00067                          container::MoveVector& win, 
00068                          container::MoveVector& draw, 
00069                          container::MoveVector& loss) const;
00070     };
00071   } // namespace game_playing
00072 } // namespace osl
00073 
00074 #endif /* OSL_GAMESTATE_H */
00075 // ;;; Local Variables:
00076 // ;;; mode:c++
00077 // ;;; c-basic-offset:2
00078 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines