kingOpenMove.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kingOpenMove.h
Go to the documentation of this file.
1 /* kingOpenMove.h
2 */
3 #ifndef OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
4 #define OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
5
6 #include "osl/move_classifier/classifierTraits.h"
7 #include "osl/state/numEffectState.h"
8 #include "osl/player.h"
9 #include "osl/ptype.h"
10
11 namespace osl
12 {
13 namespace move_classifier
14 {
22 template <Player P>
23 struct KingOpenMove
24 {
33 static bool isMember(const NumEffectState& state,
34 Ptype /*ptype*/,Square from,Square to)
35 {
36 int num=state.pieceAt(from).number();
37 assert(Piece::isPieceNum(num));
38 if(!state.pinOrOpen(P).test(num)) return false;
39 // from to kingが一直線に並べば false
40 Square king=state.kingSquare<P>();
41 return Board_Table.getShort8Unsafe<P>(king,to)
42 != Board_Table.getShort8<P>(king,from);
43 }
47 static bool isMember(const NumEffectState& state,
48 Ptype ptype,Square from,Square to,
49 Square exceptFor)
50 {
51 return isMemberMain<true>(state, ptype, from, to, exceptFor);
52 }
53 private:
54 template <bool hasException>
55 static bool
56 #ifdef __GNUC__
57 __attribute__ ((pure))
58 #endif
59 isMemberMain(const NumEffectState& state,
60 Ptype ptype,Square from,Square to,
61 Square exceptFor);
62 };
63
64 template <Player P> struct ClassifierTraits<KingOpenMove<P> >
65 {
66 static const bool drop_suitable = false;
67 static const bool result_if_drop = false;
68 };
69
70 } // namespace move_classifier
71 } // namespace osl
72 #endif /* OSL_MOVE_CLASSIFIER_NOT_KING_OPEN_MOVE_H */
73 // ;;; Local Variables:
74 // ;;; mode:c++
75 // ;;; c-basic-offset:2
76 // ;;; End: