My Project
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 
7 #include "osl/numEffectState.h"
8 
9 namespace osl
10 {
11  namespace move_generator
12  {
16  template<class Action>
17  class Capture
18  {
19  public:
23  template<Player P>
24  static void generate(const NumEffectState& state,Square target,
25  Action& action);
31  template<Player P>
32  static void escapeByCapture(const NumEffectState& state,Square target,
33  Piece piece,Action& action);
38  template<Player P>
39  static void generate1(const NumEffectState& state,Square target,
40  Action& action);
41  };
42 
47  {
48  template<class Action>
49  static void generate(Player p, const NumEffectState& state,Square target,
50  Action& action)
51  {
52  if (p == BLACK)
53  Capture<Action>::template generate<BLACK>(state,target,action);
54  else
55  Capture<Action>::template generate<WHITE>(state,target,action);
56  }
57  static void generate(Player P, const NumEffectState& state,Square target,
58  MoveVector& out)
59  {
60  using move_action::Store;
61  Store store(out);
62  generate(P, state, target, store);
63  }
64  static void generate(const NumEffectState& state,Square target,
65  MoveVector& out)
66  {
67  generate(state.turn(), state, target, out);
68  }
69  template<class Action>
70  static void generate1(Player p, const NumEffectState& state,Square target,
71  Action& action)
72  {
73  if (p == BLACK)
74  Capture<Action>::template generate1<BLACK>(state,target,action);
75  else
76  Capture<Action>::template generate1<WHITE>(state,target,action);
77  }
78  static void generate1(Player P, const NumEffectState& state,Square target,
79  MoveVector& out)
80  {
81  using move_action::Store;
82  Store store(out);
83  generate1(P, state, target, store);
84  }
85 
86  template<class Action>
87  static void escapeByCapture(Player p, const NumEffectState& state,Square target,
88  Piece piece,Action& action)
89  {
90  if (p == BLACK)
91  Capture<Action>::template escapeByCapture<BLACK>(state,target,piece,action);
92  else
93  Capture<Action>::template escapeByCapture<WHITE>(state,target,piece,action);
94  }
95  };
96 
97  } // namespace move_generator
98  using move_generator::GenerateCapture;
99 } // namespace osl
100 
101 
102 #endif /* OSL_MOVE_GENERATOR_CAPTURE_H */
103 // ;;; Local Variables:
104 // ;;; mode:c++
105 // ;;; c-basic-offset:2
106 // ;;; End:
利きを持つ局面
Player turn() const
Definition: simpleState.h:220
駒を取る手を生成
Definition: capture_.h:18
static void generate(const NumEffectState &state, Square target, Action &action)
static void escapeByCapture(const NumEffectState &state, Square target, Piece piece, Action &action)
static void generate1(const NumEffectState &state, Square target, Action &action)
取る手を1手だけ作る
Player
Definition: basic_type.h:8
@ BLACK
Definition: basic_type.h:9
指手を MoveVector に保管
Definition: move_action.h:16
Capture の Player で特殊化できないバージョン.
Definition: capture_.h:47
static void escapeByCapture(Player p, const NumEffectState &state, Square target, Piece piece, Action &action)
Definition: capture_.h:87
static void generate1(Player p, const NumEffectState &state, Square target, Action &action)
Definition: capture_.h:70
static void generate1(Player P, const NumEffectState &state, Square target, MoveVector &out)
Definition: capture_.h:78
static void generate(Player p, const NumEffectState &state, Square target, Action &action)
Definition: capture_.h:49
static void generate(const NumEffectState &state, Square target, MoveVector &out)
Definition: capture_.h:64
static void generate(Player P, const NumEffectState &state, Square target, MoveVector &out)
Definition: capture_.h:57