All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
allMoves.tcc
Go to the documentation of this file.
1 #ifndef OSL_GENERATE_ALL_MOVES_TCC
2 #define OSL_GENERATE_ALL_MOVES_TCC
10 
11 namespace osl
12 {
13  namespace move_generator
14  {
15  namespace all_moves
16  {
17  template<class Action,Player P,Ptype T>
18  void
19  generatePtype(const NumEffectState& state, Action& action){
20  for(int num=PtypeTraits<T>::indexMin;num<PtypeTraits<T>::indexLimit;++num){
21  Piece p=state.pieceOf(num);
22  if(p.isOnBoardByOwner<P>()){
23  int dummy=0;
25  const Ptype PT=PtypeTraits<PtypeFuns<T>::promotePtype >::moveType;
26  PieceOnBoard<Action>::template generatePtype<P,PT,false>(state,p,action,dummy);
27  }
28  else{
29  PieceOnBoard<Action>::template generatePtype<P,T,false>
30  (state,p,action,dummy);
31  }
32  }
33  }
34  }
35  }
40  template<class Action>
41  template<Player P>
43  generateOnBoard(const NumEffectState& state, Action& action){
44  generatePtype<Action,P,PAWN>(state,action);
45  generatePtype<Action,P,LANCE>(state,action);
46  generatePtype<Action,P,KNIGHT>(state,action);
47  generatePtype<Action,P,SILVER>(state,action);
48  generatePtype<Action,P,GOLD>(state,action);
49  generatePtype<Action,P,BISHOP>(state,action);
50  generatePtype<Action,P,ROOK>(state,action);
51  int dummy=0;
52  PieceOnBoard<Action>::template generatePtype<P,KING,false>
53  (state,state.kingPiece<P>(),action,dummy);
54  }
58  template<class Action>
59  template<Player P>
61  generate(const NumEffectState& state, Action& action){
62  generateOnBoard<P>(state,action);
63  Drop<Action>::template generate<P>(state,action);
64  }
65 
66 
67  } // namespace move_generator
68 } // namespace osl
69 
70 #endif /* OSL_GENERATE_ALL_MOVES_TCC */
71 // ;;; Local Variables:
72 // ;;; mode:c++
73 // ;;; c-basic-offset:2
74 // ;;; End: