All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
captureEffectToAroundKing8.h
Go to the documentation of this file.
1 #ifndef _GENERATE_CAPTURE_EFFECT_TO_AROUND_KING8_H
2 #define _GENERATE_CAPTURE_EFFECT_TO_AROUND_KING8_H
6 #include "osl/centering3x3.h"
9 
10 namespace osl
11 {
12  namespace move_generator
13  {
20  template <Player P>
22  {
23  template <class Action>
24  static void generateTo(const NumEffectState& state,
25  Square p,
26  Action& action)
27  {
29  capture_action;
30  capture_action capture(state, action);
31 
32  if (p.isEdge()) return;
33  assert(p.isOnBoard());
34 
35  state.template forEachEffect<PlayerTraits<P>::opponent,
36  capture_action>(p, capture);
37  }
38 
39  static void generate(const NumEffectState& state, MoveVector& moves)
40  {
41  const Square position_king =
42  Centering3x3::adjustCenter(state.template kingSquare<P>());
43  {
44  move_action::Store action(moves);
45  generateTo(state,
46  position_king,
47  action);
48  generateTo(state,
49  position_king + Board_Table.getOffsetForBlack(UL),
50  action);
51  generateTo(state,
52  position_king + Board_Table.getOffsetForBlack(U),
53  action);
54  generateTo(state,
55  position_king + Board_Table.getOffsetForBlack(UR),
56  action);
57  generateTo(state,
58  position_king + Board_Table.getOffsetForBlack(L),
59  action);
60  generateTo(state,
61  position_king + Board_Table.getOffsetForBlack(R),
62  action);
63  generateTo(state,
64  position_king + Board_Table.getOffsetForBlack(DL),
65  action);
66  generateTo(state,
67  position_king + Board_Table.getOffsetForBlack(D),
68  action);
69  generateTo(state,
70  position_king + Board_Table.getOffsetForBlack(DR),
71  action);
72  }
73  moves.unique();
74  }
75 
76  };
77  }
78 } // namespace osl
79 
80 #endif /* _GENERATE_CAPTURE_EFFECT_TO_AROUND_KING8_H */
81 // ;;; Local Variables:
82 // ;;; mode:c++
83 // ;;; c-basic-offset:2
84 // ;;; End: