00001
00002
00003 #ifndef _MOVE_CLASSIFIER_KING_OPEN_MOVE_H
00004 #define _MOVE_CLASSIFIER_KING_OPEN_MOVE_H
00005
00006 #include "osl/move_classifier/classifierTraits.h"
00007 #include "osl/state/numEffectState.h"
00008 #include "osl/player.h"
00009 #include "osl/ptype.h"
00010
00011 namespace osl
00012 {
00013 namespace move_classifier
00014 {
00022 template <Player P>
00023 struct KingOpenMove
00024 {
00033 static bool isMember(const NumEffectState& state,
00034 Ptype ,Position from,Position to)
00035 {
00036 int num=state.getPieceAt(from).number();
00037 assert(Piece::isPieceNum(num));
00038 if(!state.pinOrOpen(P).test(num)) return false;
00039
00040 Position king=state.getKingPosition<P>();
00041 return Board_Table.getShort8Unsafe<P>(king,to)
00042 != Board_Table.getShort8<P>(king,from);
00043 }
00047 static bool isMember(const NumEffectState& state,
00048 Ptype ptype,Position from,Position to,
00049 Position exceptFor)
00050 {
00051 return isMemberMain<true>(state, ptype, from, to, exceptFor);
00052 }
00053 private:
00054 template <bool hasException>
00055 static bool isMemberMain(const NumEffectState& state,
00056 Ptype ptype,Position from,Position to,
00057 Position exceptFor);
00058 };
00059
00060 template <Player P> struct ClassifierTraits<KingOpenMove<P> >
00061 {
00062 static const bool drop_suitable = false;
00063 static const bool result_if_drop = false;
00064 };
00065
00066 }
00067 }
00068 #endif
00069
00070
00071
00072
00073