Go to the documentation of this file.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/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 ,Square from,Square to)
00035 {
00036 int num=state.pieceAt(from).number();
00037 assert(Piece::isPieceNum(num));
00038 if(!state.pinOrOpen(P).test(num)) return false;
00039
00040 Square king=state.kingSquare<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,Square from,Square to,
00049 Square exceptFor)
00050 {
00051 return isMemberMain<true>(state, ptype, from, to, exceptFor);
00052 }
00053 private:
00054 template <bool hasException>
00055 static bool
00056 #ifdef __GNUC__
00057 __attribute__ ((pure))
00058 #endif
00059 isMemberMain(const NumEffectState& state,
00060 Ptype ptype,Square from,Square to,
00061 Square exceptFor);
00062 };
00063
00064 template <Player P> struct ClassifierTraits<KingOpenMove<P> >
00065 {
00066 static const bool drop_suitable = false;
00067 static const bool result_if_drop = false;
00068 };
00069
00070 }
00071 }
00072 #endif
00073
00074
00075
00076