addEffect8Defense.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
addEffect8Defense.h
Go to the documentation of this file.
1 #ifndef _GENERATE_ADD_EFFECT8_DEFENSE_H
2 #define _GENERATE_ADD_EFFECT8_DEFENSE_H
3 #include "osl/move_generator/pieceOnBoard.h"
4 #include "osl/move_generator/addEffectWithEffect.h"
5 #include "osl/move_action/store.h"
6 #include "osl/centering3x3.h"
7 #include "osl/state/numEffectState.h"
8
9 namespace osl
10 {
11 namespace move_generator
12 {
18 template <Player P>
19 struct AddEffect8Defense
20 {
21 static void generateTo(const NumEffectState& state,
22 Square p,
23 move_action::Store& action)
24 {
25 if (!p.isOnBoard()) return;
26 GenerateAddEffectWithEffect::generate<false>(P, state, p, action);
27 }
28
29 static void generate(const NumEffectState& state, MoveVector& moves)
30 {
31 const Square king = state.template kingSquare<P>();
32 const Square center = Centering3x3::adjustCenter(king);
33 {
34 move_action::Store action(moves);
35 generateTo(state, center, action);
36 generateTo(state,
37 center + Board_Table.getOffsetForBlack(UL),
38 action);
39 generateTo(state,
40 center + Board_Table.getOffsetForBlack(U),
41 action);
42 generateTo(state,
43 center + Board_Table.getOffsetForBlack(UR),
44 action);
45 generateTo(state,
46 center + Board_Table.getOffsetForBlack(L),
47 action);
48 generateTo(state,
49 center + Board_Table.getOffsetForBlack(R),
50 action);
51 generateTo(state,
52 center + Board_Table.getOffsetForBlack(DL),
53 action);
54 generateTo(state,
55 center + Board_Table.getOffsetForBlack(D),
56 action);
57 generateTo(state,
58 center + Board_Table.getOffsetForBlack(DR),
59 action);
60 }
61 moves.unique();
62 }
63 };
64 }
65 } // namespace osl
66
67 #endif /* _GENERATE_ADD_EFFECT8_DEFENSE_H */
68 // ;;; Local Variables:
69 // ;;; mode:c++
70 // ;;; c-basic-offset:2
71 // ;;; End: