All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
toAroundKing24Filter.h
Go to the documentation of this file.
1 /* toAroundKing24Filter.h
2  */
3 #ifndef _MOVE_TO_AROUND_KING24_FILTER_H
4 #define _MOVE_TO_AROUND_KING24_FILTER_H
5 #include "osl/square.h"
6 #include "osl/player.h"
7 #include "osl/ptype.h"
10 
11 namespace osl
12 {
13  namespace move_action
14  {
15 
19  template<Player P,class OrigAction>
21  {
22  BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
23  const NumEffectState& state;
24  OrigAction & action;
26 
27  public:
28  ToAroundKing24Filter(const NumEffectState& s, OrigAction & action)
29  :
30  state(s), action(action), position_king(s.template kingSquare<P>())
31  {
32  }
33 
35  {
36  //計算した方が速いだろ! by Yoshiki
77  ;
78  }
79  void simpleMove(Square from,Square to,Ptype ptype, bool isPromote,Player p,Move m){
80  assert(p == P);
81  if(isToAroundKing24Move(to))
82  action.simpleMove(from,to,ptype,isPromote,P,m);
83 
84  }
85  void unknownMove(Square from,Square to,Piece p1,Ptype ptype,bool isPromote,Player p,Move m){
86  assert(p == P);
87  if(isToAroundKing24Move(to))
88  action.unknownMove(from,to,p1,ptype,isPromote,P,m);
89  }
90  void dropMove(Square to,Ptype ptype,Player p,Move m){
91  assert(p == P);
92  if(isToAroundKing24Move(to))
93  action.dropMove(to,ptype,P,m);
94  }
95  // old interfaces
96  void simpleMove(Square from,Square to,Ptype ptype,
97  bool isPromote,Player p)
98  {
99  simpleMove(from,to,ptype,isPromote,p,
100  Move(from,to,ptype,PTYPE_EMPTY,isPromote,p));
101  }
103  Ptype ptype,bool isPromote,Player p)
104  {
105  unknownMove(from,to,captured,ptype,isPromote,p,
106  Move(from,to,ptype,captured.ptype(),isPromote,p));
107  }
108  void dropMove(Square to,Ptype ptype,Player p)
109  {
110  dropMove(to,ptype,p,
111  Move(to,ptype,p));
112  }
113  };
114  } // namespace move_action
115 } // namespace osl
116 
117 #endif /* _MOVE_TO_AROUND_KING24_FILTER_H */
118 // ;;; Local Variables:
119 // ;;; mode:c++
120 // ;;; c-basic-offset:2
121 // ;;; End: