1 #ifndef _MOVE_GENERATOR_ATTACK_TO_PINNED_TCC
2 #define _MOVE_GENERATOR_ATTACK_TO_PINNED_TCC
11 namespace move_generator
14 template<Player P,Ptype T,
class Action>
15 void generatePtype(
const NumEffectState& state,Action& action)
17 Square
target=state.template kingSquare<PlayerTraits<P>::opponent>();
18 for(
int num=PtypeTraits<T>::indexMin;num<PtypeTraits<T>::indexLimit;num++){
19 Piece p=state.pieceOf(num);
20 if(p.template isOnBoardByOwner<P>()){
21 Square from=p.square();
23 if(effect.hasEffect()){
24 Offset offset=effect.
offset();
25 assert(!offset.zero());
27 Square pos=target-offset;
28 for(;(p1=state.pieceAt(pos)).isEmpty();pos-=offset) ;
29 if(p1.canMoveOn<P>() &&
30 state.hasEffectByPiece(p,pos)){
31 AddEffectWithEffect<Action>::template generate<P,false>(state,pos,action);
39 template<
class Action>
41 generate(
const NumEffectState& state,Action& action)
43 generatePtype<P,ROOK,Action>(state,action);
44 generatePtype<P,BISHOP,Action>(state,action);
45 generatePtype<P,LANCE,Action>(state,action);