00001 /* brinkmateState.h 00002 */ 00003 #ifndef OSL_BRINKMATE_BRINKMATESTATE_H 00004 #define OSL_BRINKMATE_BRINKMATESTATE_H 00005 00006 #include "osl/checkmate/dualCheckmateSearcher.h" 00007 #include "osl/state/hashEffectState.h" 00008 #include "osl/apply_move/doUndoMoveStack.h" 00009 #include "osl/container/moveStack.h" 00010 #include "osl/stl/stack.h" 00011 00012 namespace osl 00013 { 00014 namespace brinkmate 00015 { 00016 class BrinkmateState 00017 { 00018 public: 00019 typedef DualCheckmateSearcher<> checkmate_t; 00020 private: 00021 HashEffectState m_state; 00022 checkmate_t *checkmator; // acquaintance 00023 DoUndoMoveStack<HashEffectState> move_stack; 00024 stack<int> defense_check; 00025 MoveStack moves; 00026 PathEncoding path; 00027 public: 00028 BrinkmateState(); 00029 ~BrinkmateState(); 00030 00031 void init(const HashEffectState&); 00032 void init(checkmate_t&); 00033 00034 void push(Move, bool is_defense_check); 00035 void pop(); 00036 00037 const checkmate::ProofDisproof testThreatmateState(int node); 00038 const checkmate::ProofDisproof testWinningState(int node); 00039 bool isEffectiveDefense(Move); 00040 bool isThreatmateState(int node); 00041 bool isWinningState(int node); 00042 void setEmergency() { move_stack.setEmergency(); } 00043 00044 int depth() const { return path.getDepth(); } 00045 int defenseCheckCount() const { return defense_check.top(); } 00046 int effectiveDepth() const { 00047 return path.getDepth() - defenseCheckCount(); 00048 } 00049 const HashEffectState& state() const { return m_state; } 00050 Player turn() const { return m_state.getTurn(); } 00051 const Move lastMove() const { return moves.lastMove(); } 00052 }; 00053 } // namespace brinkmate 00054 } // namespace osl 00055 00056 #endif /* OSL_BRINKMATE_BRINKMATESTATE_H */ 00057 // ;;; Local Variables: 00058 // ;;; mode:c++ 00059 // ;;; c-basic-offset:2 00060 // ;;; End: