My Project
allMoves.tcc
Go to the documentation of this file.
1#ifndef OSL_GENERATE_ALL_MOVES_TCC
2#define OSL_GENERATE_ALL_MOVES_TCC
3#include "osl/move_generator/allMoves.h"
4#include "osl/move_generator/pieceOnBoard.h"
5#include "osl/move_generator/pieceOnBoard.tcc"
6#include "osl/move_generator/drop.h"
7#include "osl/move_generator/move_action.h"
8#include "osl/numEffectState.h"
9
10namespace osl
11{
12 namespace move_generator
13 {
14 namespace all_moves
15 {
16 template<class Action,Player P,Ptype T>
17 void
18 generatePtype(const NumEffectState& state, Action& action){
19 for(int num=PtypeTraits<T>::indexMin;num<PtypeTraits<T>::indexLimit;++num){
20 Piece p=state.pieceOf(num);
21 if(p.isOnBoardByOwner<P>()){
22 int dummy=0;
23 if(PtypeTraits<T>::canPromote && p.isPromoted()){
24 const Ptype PT=PtypeTraits<PtypeFuns<T>::promotePtype >::moveType;
25 PieceOnBoard<Action>::template generatePtype<P,PT,false>(state,p,action,dummy);
26 }
27 else{
28 PieceOnBoard<Action>::template generatePtype<P,T,false>
29 (state,p,action,dummy);
30 }
31 }
32 }
33 }
34 }
35 using all_moves::generatePtype;
36 /**
37 * すべての手を生成する
38 */
39 template<class Action>
40 template<Player P>
41 void AllMoves<Action>::
42 generateOnBoard(const NumEffectState& state, Action& action){
43 generatePtype<Action,P,PAWN>(state,action);
44 generatePtype<Action,P,LANCE>(state,action);
45 generatePtype<Action,P,KNIGHT>(state,action);
46 generatePtype<Action,P,SILVER>(state,action);
47 generatePtype<Action,P,GOLD>(state,action);
48 generatePtype<Action,P,BISHOP>(state,action);
49 generatePtype<Action,P,ROOK>(state,action);
50 int dummy=0;
51 PieceOnBoard<Action>::template generatePtype<P,KING,false>
52 (state,state.kingPiece<P>(),action,dummy);
53 }
54 /**
55 * すべての手を生成する
56 */
57 template<class Action>
58 template<Player P>
59 void AllMoves<Action>::
60 generate(const NumEffectState& state, Action& action){
61 generateOnBoard<P>(state,action);
62 Drop<Action>::template generate<P>(state,action);
63 }
64
65
66 } // namespace move_generator
67} // namespace osl
68
69#endif /* OSL_GENERATE_ALL_MOVES_TCC */
70// ;;; Local Variables:
71// ;;; mode:c++
72// ;;; c-basic-offset:2
73// ;;; End: