All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
openKingRoad.h
Go to the documentation of this file.
1 #ifndef _GENERATE_OPEN_KING_ROAD_H
2 #define _GENERATE_OPEN_KING_ROAD_H
4 
5 namespace osl
6 {
7  namespace move_generator
8  {
12  template <Player P>
13  struct OpenKingRoad
14  {
15 
16  template <class Action>
17  static void generateDir(const NumEffectState& state, Action& action, const Direction& dir)
18  {
19  Square pos = state.kingSquare<P>()
20  + Board_Table.getOffset<P>(dir);
21  if (pos.isEdge()) return;
22 
23  Piece piece = state.pieceOnBoard(pos);
24  if (piece != Piece::EMPTY() && piece.owner() == P)
25  {
26  PieceOnBoard<Action>::template generate<P,false>(state, piece, action);
27  }
28  }
29 
30  template <class Action>
31  static void generate(const NumEffectState& state, Action& action)
32  {
33  generateDir(state, action, UL);
34  generateDir(state, action, U);
35  generateDir(state, action, UR);
36  generateDir(state, action, L);
37  generateDir(state, action, R);
38  generateDir(state, action, DL);
39  generateDir(state, action, D);
40  generateDir(state, action, DR);
41  }
42  };
43  }
44 } // namespace osl
45 
46 #endif /* _GENERATE_OPEN_KING_ROAD_H */
47 // ;;; Local Variables:
48 // ;;; mode:c++
49 // ;;; c-basic-offset:2
50 // ;;; End: