1 #ifndef OSL_PIECE_ON_BOARD_H
2 #define OSL_PIECE_ON_BOARD_H
6 #include <boost/static_assert.hpp>
14 namespace move_generator
19 template<
class Action,
bool noCapturePromote=false>
28 assert(state.hasEffectByPiece(p, target));
33 action.unknownMove(from,target,p1,
promote(ptype),
true,P);
34 int y=(P==
BLACK ? target.
y() : 10-target.
y());
36 (((ptype==
LANCE || ptype==
PAWN) ? y==3 :
true )) &&
38 action.unknownMove(from,target,p1,ptype,
false,P);
41 action.unknownMove(from,target,p1,
promote(ptype),
true,P);
43 action.unknownMove(from,target,p1,ptype,
false,P);
46 action.unknownMove(from,target,p1,ptype,
false,P);
49 action.unknownMove(from,target,p1,ptype,
false,P);
60 if(state.hasEffectAt<altP>(target))
return;
62 if(state.pinOrOpen(P).test(p.
number())){
67 generatePieceUnsafe<P>(state,p,
target,p1,action);
73 template<Player P,Ptype T>
76 assert(state.hasEffectByPiece(p, target));
81 action.unknownMove(from,target,p1,
promote(T),
true,P);
83 (P==
BLACK ? target.
y()==1 : target.
y()==9))||
87 (T==
LANCE && (P==
BLACK ? target.
y()==2 : target.
y()==8))))
90 action.unknownMove(from,target,p1,T,
false,P);
92 template<Player P,Ptype T>
96 assert(!state.hasEffectAt(
alt(P),p.
square()));
97 if(state.hasEffectAt(
alt(P),target))
return;
99 else if(state.pin(P).test(p.
number())){
104 generatePiecePtypeUnsafe<P,T>(state,p,
target,p1,action);
114 template <Player P,Ptype T,
bool useDirMask>
115 static void generatePtype(
const NumEffectState& state,
Piece p, Action& action,
int dirMask=0);
117 template <Player P,Ptype T>
121 generatePtype<P,T,false>(state,p,action,dummy);
131 template <Player P,Ptype T,
bool useDirMask>
133 template <Player P,Ptype T>
137 generatePtypeUnsafe<P,T,false>(state,p,action,dummy);
147 template <Player P,
bool useDirMask>
148 static void generate(
const NumEffectState& state,
Piece p, Action& action,
int dirMask=0);