1 #ifndef OSL_MOVE_GENERATOR_PROMOTE_TCC
2 #define OSL_MOVE_GENERATOR_PROMOTE_TCC
10 namespace move_generator
14 template<Player P,Ptype T,
bool noCapture,Direction Dir>
17 template <
class Action>
19 Int2Type<true> , Int2Type<true>)
23 Square last = state.mobilityOf(black_direction, piece.
number());
26 assert(!offset.
zero());
27 for (
Square to=from+offset; to!=last; to+=offset) {
28 assert(state.pieceAt(to).isEmpty());
31 const Piece last_piece = state.pieceAt(last);
32 if (!noCapture && last_piece.
canMoveOn<P>()){
37 template <
class Action>
39 Int2Type<false> ,Int2Type<true>){
43 Piece p1=state.pieceAt(toPos);
47 else if (!noCapture && p1.
canMoveOn<P>()){
51 template <
class Action>
54 template <
class Action>
58 template<
class Action>
59 static void generate(NumEffectState
const& state,
Piece p,Action& action){
69 template<Player P,Ptype T,
bool noCapture>
72 template<
class Action>
73 static void generate(NumEffectState
const& state,
Piece p,Action& action){
94 template<Player P,Ptype T,
bool noCapture,Direction Dir>
97 template <
class Action>
99 Int2Type<true> , Int2Type<true>)
103 Square last = state.mobilityOf(black_direction, piece.
number());
106 assert(! offset.
zero());
108 const Piece last_piece = state.pieceAt(last);
109 if (!noCapture && last_piece.canMoveOn<P>()){
114 for (
Square to=last-offset; to!=from; to-=offset) {
115 assert(state.pieceAt(to).isEmpty());
116 if (! to.canPromote<P>())
122 template <
class Action>
123 static void generateIfValid(
const NumEffectState& state,
Piece p, Action& action, Int2Type<false>,Int2Type<true>){
127 Piece p1=state.pieceAt(toPos);
131 else if (!noCapture && p1.
canMoveOn<P>()){
135 template <
class Action>
138 template <
class Action>
142 template<
class Action>
153 template<Player P,Ptype T,
bool noCapture>
156 template<
class Action>
169 template<
typename Action,Player P,Ptype T,
bool noCapture>
178 if (p.
square().template canPromote<P>()){
189 template<Player P,
bool noCapture>
190 template <
class Action, Ptype T>
191 void Promote<P,noCapture>::
192 generateMovesPtype(
const NumEffectState& state, Action& action){
194 each_t eachOnBoard(state,action);
195 state.template forEachOnBoardPtypeStrict<P,T,each_t>(eachOnBoard);
198 template<Player P,
bool noCapture>
199 template <
class Action>
204 generateMovesPtype<Action,PAWN>(state,action);
206 generateMovesPtype<Action,ROOK>(state,action);
208 generateMovesPtype<Action,BISHOP>(state,action);
210 generateMovesPtype<Action,LANCE>(state,action);
212 generateMovesPtype<Action,KNIGHT>(state,action);
214 generateMovesPtype<Action,SILVER>(state,action);