説明を見る。00001
00002
00003 #ifndef OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
00004 #define OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
00005
00006 #include "osl/move_classifier/classifierTraits.h"
00007 #include "osl/numEffectState.h"
00008
00009 namespace osl
00010 {
00011 namespace move_classifier
00012 {
00020 template <Player P>
00021 struct KingOpenMove
00022 {
00031 static bool isMember(const NumEffectState& state,
00032 Ptype ,Square from,Square to)
00033 {
00034 int num=state.pieceAt(from).number();
00035 assert(Piece::isPieceNum(num));
00036 if(!state.pinOrOpen(P).test(num)) return false;
00037
00038 Square king=state.kingSquare<P>();
00039 return Board_Table.getShort8Unsafe<P>(king,to)
00040 != Board_Table.getShort8<P>(king,from);
00041 }
00045 static bool isMember(const NumEffectState& state,
00046 Ptype ptype,Square from,Square to,
00047 Square exceptFor)
00048 {
00049 return isMemberMain<true>(state, ptype, from, to, exceptFor);
00050 }
00051 private:
00052 template <bool hasException>
00053 static bool
00054 #ifdef __GNUC__
00055 __attribute__ ((pure))
00056 #endif
00057 isMemberMain(const NumEffectState& state,
00058 Ptype ptype,Square from,Square to,
00059 Square exceptFor);
00060 };
00061
00062 template <Player P> struct ClassifierTraits<KingOpenMove<P> >
00063 {
00064 static const bool drop_suitable = false;
00065 static const bool result_if_drop = false;
00066 };
00067
00068 }
00069 }
00070 #endif
00071
00072
00073
00074