All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
capture_.h
Go to the documentation of this file.
1 /* capture_.h
2  */
3 #ifndef OSL_MOVE_GENERATOR_CAPTURE_H
4 #define OSL_MOVE_GENERATOR_CAPTURE_H
5 
10 
11 namespace osl
12 {
13  namespace move_generator
14  {
18  template<class Action>
19  class Capture
20  {
21  BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
22  public:
26  template<Player P>
27  static void generate(const NumEffectState& state,Square target,
28  Action& action);
34  template<Player P>
35  static void escapeByCapture(const NumEffectState& state,Square target,
36  Piece piece,Action& action);
41  template<Player P>
42  static void generate1(const NumEffectState& state,Square target,
43  Action& action);
44  };
45 
50  {
51  template<class Action>
52  static void generate(Player p, const NumEffectState& state,Square target,
53  Action& action)
54  {
55  if (p == BLACK)
56  Capture<Action>::template generate<BLACK>(state,target,action);
57  else
58  Capture<Action>::template generate<WHITE>(state,target,action);
59  }
60  static void generate(Player P, const NumEffectState& state,Square target,
61  MoveVector& out)
62  {
63  using move_action::Store;
64  Store store(out);
65  generate(P, state, target, store);
66  }
67  static void generate(const NumEffectState& state,Square target,
68  MoveVector& out)
69  {
70  generate(state.turn(), state, target, out);
71  }
72  template<class Action>
73  static void generate1(Player p, const NumEffectState& state,Square target,
74  Action& action)
75  {
76  if (p == BLACK)
77  Capture<Action>::template generate1<BLACK>(state,target,action);
78  else
79  Capture<Action>::template generate1<WHITE>(state,target,action);
80  }
81  static void generate1(Player P, const NumEffectState& state,Square target,
82  MoveVector& out)
83  {
84  using move_action::Store;
85  Store store(out);
86  generate1(P, state, target, store);
87  }
88 
89  template<class Action>
90  static void escapeByCapture(Player p, const NumEffectState& state,Square target,
91  Piece piece,Action& action)
92  {
93  if (p == BLACK)
94  Capture<Action>::template escapeByCapture<BLACK>(state,target,piece,action);
95  else
96  Capture<Action>::template escapeByCapture<WHITE>(state,target,piece,action);
97  }
98  };
99 
100  } // namespace move_generator
101  using move_generator::GenerateCapture;
102 } // namespace osl
103 
104 
105 #endif /* OSL_MOVE_GENERATOR_CAPTURE_H */
106 // ;;; Local Variables:
107 // ;;; mode:c++
108 // ;;; c-basic-offset:2
109 // ;;; End: