My Project
moveAdaptor.h
Go to the documentation of this file.
1 /* moveAdaptor.h
2  */
3 #ifndef OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H
4 #define OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H
5 
6 #include "osl/numEffectState.h"
8 namespace osl
9 {
10  namespace move_classifier
11  {
12  template <class Classifier>
13  struct MoveAdaptor
14  {
15  static bool isMember(const NumEffectState& state, Move m)
16  {
17  return Classifier::isMember(state, m.ptype(), m.from(), m.to());
18  }
19  };
20 
21  template <template <Player> class Classifier>
23  {
24  template <class State>
25  static bool isMember(const State& state, Move m)
26  {
27  assert(m.player() == state.turn());
28  if (state.turn() == BLACK)
29  return Classifier<BLACK>::isMember(state, m.ptype(), m.from(), m.to());
30  else
31  return Classifier<WHITE>::isMember(state, m.ptype(), m.from(), m.to());
32  }
33  };
34 
36  template <template <Player> class Classifier>
38  {
39  template <class State>
40  static bool isMember(const State& state, Move m)
41  {
42  if (! ClassifierTraits<Classifier<BLACK> >::drop_suitable
43  && m.isDrop())
44  return ClassifierTraits<Classifier<BLACK> >::result_if_drop;
46  }
47  };
48  } // namespace move_classifier
49 } // namespace osl
50 
51 #endif /* OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H */
52 // ;;; Local Variables:
53 // ;;; mode:c++
54 // ;;; c-basic-offset:2
55 // ;;; End:
圧縮していない moveの表現 .
Definition: basic_type.h:1052
Ptype ptype() const
Definition: basic_type.h:1155
Player player() const
Definition: basic_type.h:1195
bool isDrop() const
Definition: basic_type.h:1150
const Square to() const
Definition: basic_type.h:1132
const Square from() const
Definition: basic_type.h:1125
利きを持つ局面
@ BLACK
Definition: basic_type.h:9
drop の時は呼べないなどの条件を代わりにテスト
Definition: moveAdaptor.h:38
static bool isMember(const State &state, Move m)
Definition: moveAdaptor.h:40
static bool isMember(const NumEffectState &state, Move m)
Definition: moveAdaptor.h:15
static bool isMember(const State &state, Move m)
Definition: moveAdaptor.h:25