1 /* generateCaptureMoves.tcc
3 #ifndef _GENERATECAPTUREMOVES_TCC
4 #define _GENERATECAPTUREMOVES_TCC
6 #include "osl/move_generator/capture_.h"
7 #include "osl/move_generator/pieceOnBoard.h"
8 #include "osl/move_generator/effect_action.h"
9 #include "osl/basic_type.h"
13 namespace move_generator
15 using namespace effect_action;
18 template<Player P,class Action>
19 void generate(const NumEffectState& state,Square target,Action& action,PieceMask pieces)
21 Piece p1=state.pieceAt(target);
23 int num=pieces.takeOneBit();
24 Piece p=state.pieceOf(num);
25 if(state.pinOrOpen(P).test(num) && !state.pinnedCanMoveTo<P>(p,target))
27 PieceOnBoard<Action>::template generatePiece<P>(state,p,target,p1,action);
32 template<class Action>
34 void Capture<Action>::
35 generate(const NumEffectState& state,Square target,Action& action)
37 assert(target.isOnBoard());
38 PieceMask pieces=state.piecesOnBoard(P)&state.effectSetAt(target);
39 capture::generate<P,Action>(state,target,action,pieces);
42 template<class Action>
44 void Capture<Action>::
45 escapeByCapture(const NumEffectState& state,Square target,Piece piece,Action& action)
47 PieceMask pieces=state.piecesOnBoard(P)&state.effectSetAt(target);
48 pieces.reset(piece.number());
49 capture::generate<P,Action>(state,target,action,pieces);
52 } // namespace move_generator
55 template<class Action>
56 template<osl::Player P>
57 void osl::move_generator::Capture<Action>::
58 generate1(const NumEffectState& state,Square target,
61 Piece move = state.findCheapAttackNotBy(P, target, state.pinOrOpen(P));
63 move = state.findCheapAttack(P, target);
65 PieceOnBoard<Action>::template generatePiece<P>
66 (state,move,target,state.pieceAt(target),action);
70 #endif /* _GENERATECAPTUREMOVES_TCC */
71 // ;;; Local Variables:
73 // ;;; c-basic-offset:2