safeMove.h
Go to the documentation of this file.
00001 /* safeMove.h
00002  */
00003 #ifndef OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
00004 #define OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
00005 #include "osl/move_classifier/kingOpenMove.h"
00006 #include "osl/move_classifier/classifierTraits.h"
00007 #include "osl/state/numEffectState.h"
00008 namespace osl
00009 {
00010   namespace move_classifier
00011   {
00016     template <Player P>
00017     struct SafeMove
00018     {
00019       static bool isMember(const NumEffectState& state, 
00020                            Ptype ptype,Square from,Square to)
00021       {
00022         assert(! from.isPieceStand());
00023         assert(state.pieceOnBoard(from).owner() == P);
00028         if (ptype==KING)
00029           return ! state.template hasEffectAt<PlayerTraits<P>::opponent>(to);
00030         return ! KingOpenMove<P>::isMember(state,ptype,from,to);
00031       }
00032     };
00033 
00034     template <Player P> struct ClassifierTraits<SafeMove<P> >
00035     {
00036       static const bool drop_suitable = false;
00037       static const bool result_if_drop = true;
00038     };
00039   }
00040 }
00041 #endif /* OSL_MOVE_CLASSIFIER_SAFE_MOVE_H */
00042 // ;;; Local Variables:
00043 // ;;; mode:c++
00044 // ;;; c-basic-offset:2
00045 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines