00001 /* safeMove.h 00002 */ 00003 #ifndef _MOVE_CLASSIFIER_SAFE_MOVE_H 00004 #define _MOVE_CLASSIFIER_SAFE_MOVE_H 00005 #include "osl/position.h" 00006 #include "osl/player.h" 00007 #include "osl/ptype.h" 00008 #include "osl/piece.h" 00009 #include "osl/move_classifier/kingOpenMove.h" 00010 #include "osl/move_classifier/classifierTraits.h" 00011 namespace osl 00012 { 00013 namespace move_classifier 00014 { 00019 template <Player P> 00020 struct SafeMove 00021 { 00022 template <class State> 00023 static bool isMember(const State& state, 00024 Ptype ptype,Position from,Position to) 00025 { 00026 assert(! from.isPieceStand()); 00027 assert(state.getPieceOnBoard(from).owner() == P); 00032 if (ptype==KING) 00033 return ! state.template hasEffectBy<PlayerTraits<P>::opponent>(to); 00034 return ! KingOpenMove<P>::isMember(state,ptype,from,to); 00035 } 00036 }; 00037 00038 template <Player P> struct ClassifierTraits<SafeMove<P> > 00039 { 00040 static const bool drop_suitable = false; 00041 static const bool result_if_drop = true; 00042 }; 00043 } 00044 } 00045 #endif /* _MOVE_CLASSIFIER_SAFE_MOVE_H */ 00046 // ;;; Local Variables: 00047 // ;;; mode:c++ 00048 // ;;; c-basic-offset:2 00049 // ;;; End: