1 #ifndef _GENERATER_ADD_EFFECT_WITH_EFFECT_TCC
2 #define _GENERATER_ADD_EFFECT_WITH_EFFECT_TCC
14 namespace move_generator
30 template<osl::Player P,
class Action>
34 assert(toP==state.pieceAt(to));
40 if(((1<<pptype)&ptypeMask)!=0)
41 action.unknownMove(from,to,toP,pptype,
true,P);
42 if(Move::ignoreUnpromote<P>(ptype,from,to))
return;
45 if(((1<<ptype)&ptypeMask)!=0)
46 action.unknownMove(p.
square(),to,toP,ptype,
false,P);
58 template<osl::Player P,
class Action>
63 if(!state.hasEffectAt<altP>(to)){
64 action.unknownMove(state.kingSquare<P>(),to,toP,
KING,
false,P);
68 while (pieceMask.any()){
69 const int num=pieceMask.takeOneBit();
70 Piece p=state.pieceOf(num);
71 if(state.pinOrOpen(P).test(num)){
76 generateMovePiecePtypeMask<P,Action>(state,p,to,toP,action,ptypeMask);
79 template<osl::Player P,
class Action>
82 PieceMask pieceMask=state.piecesOnBoard(P)&state.effectSetAt(to);
85 pieceMask &= ~state.pinOrOpen(altP);
86 generateMoveToPtypeMaskWithPieceMask<P,Action>(state,to,toP,action,ptypeMask,pieceMask);
88 #ifndef GENERATE_PAWNDROP_CHECKMATE
92 template<osl::Player P>
100 NumBitmapEffect effect=state.effectSetAt(pos);
101 mask_t mask=(effect.getMask(1)& NumBitmapEffect::longEffectMask());
102 mask&=state.piecesOnBoard(P).getMask(1)<<8;
104 int num=mask.takeOneBit()+NumBitmapEffect::longToNumOffset;
106 if( (P==
BLACK ? from.
y()>=pos.
y() : pos.
y()>=from.
y()) ){
108 assert((P==
BLACK ? shadowPos.
y()<=pos.
y() : pos.
y()<=shadowPos.
y()) );
109 Piece p=state.pieceAt(shadowPos);
110 if(p.
canMoveOn<altP>() && !state.hasMultipleEffectAt(P,shadowPos)){
124 template<osl::Player P,
int DirType,
class Action>
128 Square pos=target-dirOffset;
130 Piece p=state.pieceAt(pos);
132 if(DirType==0 && state.hasLongEffectAt<
LANCE>(P,pos)){
137 if((state.Iking8Info(altP)&(1ull<<(40+Dir)))!=0){
140 generateMoveToPtypeMask<P,Action>(state,pos,p,action,
143 if(DirType !=0)
return;
145 Square pos1=state.kingMobilityOfPlayer(altP,Dir);
146 mask_t lance_mask=state.longEffectAt<
LANCE>(pos1,P);
147 if(lance_mask.any()){
148 Piece p1=state.pieceAt(pos1);
152 if(state.hasEffectByPiece(p1,pos)){
157 assert(!lance_mask.hasMultipleBit());
159 Piece p2=state.pieceOf(num);
160 if(!state.pinOrOpen(P).test(num) ||
161 state.kingSquare<P>().isUD(p2.
square())){
162 action.unknownMove(p2.
square(),pos1,p1,
LANCE,
false,P);
168 if(! state.isPawnMaskSet<P>(target.
x()) &&
169 state.hasPieceOnStand<
PAWN>(P)){
171 #ifndef GENERATE_PAWNDROP_CHECKMATE
172 if(((state.Iking8Info(altP)&(0xff00ull|(1ull<<(U+24))))^(1ull<<(U+24)))!=0 || blockingU<P>(state,pos))
173 action.dropMove(pos,
PAWN,P);
175 hasPawnCheckmate=
true;
177 action.dropMove(pos,
PAWN,P);
180 if(state.hasPieceOnStand<
LANCE>(P)){
181 action.dropMove(pos,
LANCE,P);
184 action.dropMove(pos,
LANCE,P);
190 template<osl::Player P,
int DirType,
class Action,Direction Dir>
193 generateDir<P,DirType,Action>(state,
target,action,hasPawnCheckmate,
202 template<osl::Player P,
int DirType,
class Action>
203 void generateDirNotKing(
const NumEffectState& state,
Square target,Action& action,CArray<unsigned char,8>& pieceMobility,
int& spaces, PieceMask
const& notPieceMask,
Offset dirOffset,
Direction Dir,
Direction primDir,
int ptypeMask,
Direction dirByBlack
207 Square pos=target-dirOffset;
209 pieceMobility[dirByBlack]=pos.
uintValue();
212 Piece p=state.pieceAt(pos);
215 const PieceMask pieceMask=state.piecesOnBoard(P)&state.effectSetAt(pos)¬PieceMask & ~state.effectSetAt(target);
217 detail:: template generateMoveToPtypeMaskWithPieceMask<P,Action>(state,pos,p,action,
218 ptypeMask,pieceMask);
223 if(DirType==0 && ! state.isPawnMaskSet<P>(target.
x()) &&
224 state.hasPieceOnStand<
PAWN>(P))
225 action.dropMove(pos,
PAWN,P);
228 p=state.pieceAt(pos);
240 while((p=state.pieceAt(pos)).isEmpty())
245 Piece p1=state.findLongAttackAt(altP,p,Dir);
250 if(!state.pinOrOpen(P).test(num) ||
252 action.unknownMove(p1.
square(),pos,p,
LANCE,
false,P);
263 while((p=state.pieceAt(pos)).isEmpty())
267 pieceMobility[dirByBlack]=pos.
uintValue();
276 mask_t lance_mask=state.longEffectAt<
LANCE>(pos,P);
277 if(lance_mask.any()){
278 assert(!lance_mask.hasMultipleBit());
280 Piece p2=state.pieceOf(num);
281 if(!state.pinOrOpen(P).test(num) ||
282 state.kingSquare<P>().isUD(p2.
square())){
283 action.unknownMove(p2.
square(),pos,p,
LANCE,
false,P);
288 mask_t rook_mask=state.allEffectAt<
ROOK>(P,pos);
289 while(rook_mask.any()){
291 Piece p2=state.pieceOf(num);
299 while(bishop_mask.any()){
301 Piece p2=state.pieceOf(num);
311 if(state.hasPieceOnStand<
LANCE>(P)){
314 if(state.pieceAt(pos).isEmpty())
315 action.dropMove(pos,
LANCE,P);
321 template<osl::Player P,
int DirType,
class Action,Direction Dir>
322 void generateDirNotKing(
const NumEffectState& state,
Square target,Action& action,CArray<unsigned char,8>& pieceMobility,
int& spaces, PieceMask
const& notPieceMask)
324 generateDirNotKing<P,DirType,Action>(state,
target,action,pieceMobility,spaces,notPieceMask,
328 template<osl::Player P,osl::Direction Dir,
class Action,
bool hasKnight>
333 Piece p=state.pieceAt(pos);
336 mask &= ~state.promotedPieces().getMask<
KNIGHT>();
341 Piece p1=state.pieceOf(num);
345 action.dropMove(pos,
KNIGHT,P);
348 template<osl::Player P,
class Action>
351 if(state.hasPieceOnStand<
KNIGHT>(P)){
352 detail::generateKnightDir<P,UUL,Action,true>(state,
target,action);
353 detail::generateKnightDir<P,UUR,Action,true>(state,
target,action);
356 detail::generateKnightDir<P,UUL,Action,false>(state,
target,action);
357 detail::generateKnightDir<P,UUR,Action,false>(state,
target,action);
360 template <osl::Player P,
class Action>
363 if((spaceMask&dirMask)!=0){
365 action.dropMove(pos,T,P);
368 template <osl::Player P,
class Action,Direction Dir>
373 template<Player P,
class Action,
bool mustCareSilver>
379 assert(mid.isOnBoard());
381 Square mid1=state.kingMobilityOfPlayer(altP,d);
383 Piece p1=state.pieceAt(mid);
390 if(state.hasEffectByPiece(p1,target_next)){
392 if(mustCareSilver && p1.ptype()==
SILVER &&
393 (P==
BLACK ? target.
y()>mid.y() : target.
y()<mid.y())){
395 if(!state.pinOrOpen(P).test(p1.number())){
412 template<osl::Player P,
class Action>
418 if(state.pinOrOpen(altP).test(num))
continue;
419 Piece p=state.pieceOf(num);
422 generateOpenOrCapture<P,Action,false>(state,
target,p,num,action);
425 int target_x=target.
x();
426 int target_y=target.
y();
430 if((
unsigned int)(target_x-rook_x+1)>2u){
431 if((
unsigned int)(target_y-rook_y+1)>2u){
433 Square pos(rook_x,target_y);
434 Piece p1=state.pieceAt(pos);
435 if(state.effectSetAt(pos).test(num) &&
437 state.kingMobilityAbs(altP,
R).uintValue() >= pos.
uintValue() &&
438 pos.
uintValue() >= state.kingMobilityAbs(altP,
L).uintValue() &&
439 (!state.pinOrOpen(P).test(num) ||
442 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
446 Square pos(target_x,rook_y);
447 Piece p1=state.pieceAt(pos);
448 if(state.effectSetAt(pos).test(num) &&
450 state.kingMobilityAbs(altP,
U).uintValue() >= pos.
uintValue() &&
451 pos.
uintValue() >= state.kingMobilityAbs(altP,
D).uintValue() &&
452 (!state.pinOrOpen(P).test(num) ||
455 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
460 int min_x=state.kingMobilityAbs(altP,
L).x();
461 int max_x=state.kingMobilityAbs(altP,
R).x();
462 if(target_x>rook_x) max_x=target_x-2;
463 else min_x=target_x+2;
466 for(
int x=min_x;x<=max_x;x++){
468 Piece p1=state.pieceAt(pos);
474 else if((
unsigned int)(target_y-rook_y+1)>2u){
475 int min_y=state.kingMobilityAbs(altP,
D).y();
476 int max_y=state.kingMobilityAbs(altP,
U).y();
477 if(target_y>rook_y) max_y=target_y-2;
478 else min_y=target_y+2;
481 for(
int y=min_y;y<=max_y;y++){
483 Piece p1=state.pieceAt(pos);
491 if((
unsigned int)(target_x-rook_x+1)>2u){
492 Square pos(rook_x,target_y);
493 Piece p1=state.pieceAt(pos);
494 if(state.effectSetAt(pos).test(num) &&
496 state.kingMobilityAbs(altP,
R).uintValue() >= pos.
uintValue() &&
497 pos.
uintValue() >= state.kingMobilityAbs(altP,
L).uintValue() &&
498 (!state.pinOrOpen(P).test(num) ||
501 if(Square::canPromoteY<P>(rook_y) || Square::canPromoteY<P>(target_y)){
502 action.unknownMove(p.
square(),pos,p1,
PROOK,
true,P);
504 else action.unknownMove(p.
square(),pos,p1,
ROOK,
false,P);
508 if((
unsigned int)(target_y-rook_y+1)>2u){
509 Square pos(target_x,rook_y);
510 Piece p1=state.pieceAt(pos);
511 if(state.effectSetAt(pos).test(num) &&
513 state.kingMobilityAbs(altP,
U).uintValue() >= pos.
uintValue() &&
514 pos.
uintValue() >= state.kingMobilityAbs(altP,
D).uintValue() &&
515 (!state.pinOrOpen(P).test(num) ||
518 if(Square::canPromoteY<P>(rook_y)){
519 action.unknownMove(p.
square(),pos,p1,
PROOK,
true,P);
522 action.unknownMove(p.
square(),pos,p1,
ROOK,
false,P);
528 template<osl::Player P,
class Action>
532 Piece p=state.pieceOf(num);
538 if(state.pin(P).test(num)){
542 int target_x=target.
x();
543 int target_y=target.
y();
547 if((
unsigned int)(target_x-rook_x+1)>2u){
548 if((
unsigned int)(target_y-rook_y+1)>2u){
550 Square pos(rook_x,target_y);
551 Piece p1=state.pieceAt(pos);
555 (dirMask&(1<<
U))==0 &&
556 state.effectSetAt(pos).test(num)
558 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
562 Square pos(target_x,rook_y);
563 Piece p1=state.pieceAt(pos);
567 (dirMask&(1<<
L))==0 &&
568 state.effectSetAt(pos).test(num)){
569 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
576 if(target_x>rook_x) max_x=target_x-2;
577 else min_x=target_x+2;
580 for(
int x=min_x;x<=max_x;x++){
583 Piece p1=state.pieceAt(pos);
585 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
589 else if((
unsigned int)(target_y-rook_y+1)>2u){
592 if(target_y>rook_y) max_y=target_y-2;
593 else min_y=target_y+2;
596 for(
int y=min_y;y<=max_y;y++){
599 Piece p1=state.pieceAt(pos);
601 action.unknownMove(p.
square(),pos,p1,
PROOK,
false,P);
607 if((
unsigned int)(target_x-rook_x+1)>2u){
608 Square pos(rook_x,target_y);
609 Piece p1=state.pieceAt(pos);
613 (dirMask&(1<<
U))==0 &&
614 state.effectSetAt(pos).test(num)
616 if(Square::canPromoteY<P>(rook_y) || Square::canPromoteY<P>(target_y)){
617 action.unknownMove(p.
square(),pos,p1,
PROOK,
true,P);
620 action.unknownMove(p.
square(),pos,p1,
ROOK,
false,P);
624 if((
unsigned int)(target_y-rook_y+1)>2u){
625 Square pos(target_x,rook_y);
626 Piece p1=state.pieceAt(pos);
627 if(p1.template canMoveOn<P>() &&
630 (dirMask&(1<<
L))==0 &&
631 state.effectSetAt(pos).test(num)
633 if(Square::canPromoteY<P>(rook_y)){
634 action.unknownMove(p.
square(),pos,p1,
PROOK,
true,P);
637 action.unknownMove(p.
square(),pos,p1,
ROOK,
false,P);
643 template<Player P,Ptype T,
class Action>
647 int target_x=target.
x();
648 int target_y=target.
y();
649 int target_xPy=target_x+target_y;
650 int target_xMy=target_x-target_y;
653 int bishop_xPy=bishop_x+bishop_y;
654 int bishop_xMy=bishop_x-bishop_y;
655 if(((target_xPy^bishop_xPy)&1)!=0){
658 if((
unsigned int)(target_xPy-bishop_xPy+1)<=2u){
659 Square ul=state.kingMobilityAbs(altP,
UL);
660 Square dr=state.kingMobilityAbs(altP,
DR);
661 int min_xMy=ul.
x()-ul.
y();
662 int max_xMy=dr.
x()-dr.
y();
663 if(target_xMy>bishop_xMy) max_xMy=target_xMy-4;
664 else min_xMy=target_xMy+4;
665 min_xMy=
std::max(min_xMy,bishop_xMy-1);
666 max_xMy=
std::min(max_xMy,bishop_xMy+1);
667 for(
int xMy=min_xMy;xMy<=max_xMy;xMy+=2){
668 int pos_x=(target_xPy+xMy)>>1;
669 int pos_y=(target_xPy-xMy)>>1;
671 Piece p1=state.pieceAt(pos);
676 else if((
unsigned int)(target_xMy-bishop_xMy+1)<=2u){
677 Square dl=state.kingMobilityAbs(altP,
DL);
678 Square ur=state.kingMobilityAbs(altP,
UR);
679 int min_xPy=dl.
x()+dl.
y();
680 int max_xPy=ur.
x()+ur.
y();
681 if(target_xPy>bishop_xPy) max_xPy=target_xPy-4;
682 else min_xPy=target_xPy+4;
683 min_xPy=
std::max(min_xPy,bishop_xPy-1);
684 max_xPy=
std::min(max_xPy,bishop_xPy+1);
685 for(
int xPy=min_xPy;xPy<=max_xPy;xPy+=2){
686 int pos_x=(xPy+target_xMy)>>1;
687 int pos_y=(xPy-target_xMy)>>1;
689 Piece p1=state.pieceAt(pos);
697 if((
unsigned int)(target_xPy-bishop_xPy+2)>4u){
698 int pos_x=(bishop_xPy+target_xMy)>>1;
699 int pos_y=(bishop_xPy-target_xMy)>>1;
702 Piece p1=state.pieceAt(pos);
703 if(state.effectSetAt(pos).test(num) &&
705 state.kingMobilityAbs(altP,
UR).uintValue() >= pos.
uintValue() &&
706 pos.
uintValue() >= state.kingMobilityAbs(altP,
DL).uintValue()
712 else if(target_xPy==bishop_xPy){
713 generateOpenOrCapture<P,Action,true>(state,
target,p,num,action);
717 if((
unsigned int)(target_xMy-bishop_xMy+2)>4u){
718 int pos_x=(target_xPy+bishop_xMy)>>1;
719 int pos_y=(target_xPy-bishop_xMy)>>1;
722 Piece p1=state.pieceAt(pos);
723 if(state.effectSetAt(pos).test(num) &&
725 state.kingMobilityAbs(altP,
DR).uintValue() >= pos.
uintValue() &&
726 pos.
uintValue() >= state.kingMobilityAbs(altP,
UL).uintValue()
732 else if(target_xMy==bishop_xMy){
733 generateOpenOrCapture<P,Action,true>(state,
target,p,num,action);
738 template<osl::Player P,Ptype T,
class Action>
741 int target_x=target.
x();
742 int target_y=target.
y();
743 int target_xPy=target_x+target_y;
744 int target_xMy=target_x-target_y;
747 int bishop_xPy=bishop_x+bishop_y;
748 int bishop_xMy=bishop_x-bishop_y;
749 if(((target_xPy^bishop_xPy)&1)!=0){
752 if((
unsigned int)(target_xPy-bishop_xPy+1)<=2u){
755 int min_xMy=ul.
x()-ul.
y()+2;
756 int max_xMy=dr.
x()-dr.
y()-2;
757 if(target_xMy>bishop_xMy) max_xMy=target_xMy-4;
758 else min_xMy=target_xMy+4;
759 min_xMy=
std::max(min_xMy,bishop_xMy-1);
760 max_xMy=
std::min(max_xMy,bishop_xMy+1);
761 for(
int xMy=min_xMy;xMy<=max_xMy;xMy+=2){
762 int pos_x=(target_xPy+xMy)>>1;
763 int pos_y=(target_xPy-xMy)>>1;
765 Piece p1=state.pieceAt(pos);
771 else if((
unsigned int)(target_xMy-bishop_xMy+1)<=2u){
774 int min_xPy=dl.
x()+dl.
y()+2;
775 int max_xPy=ur.
x()+ur.
y()-2;
776 if(target_xPy>bishop_xPy) max_xPy=target_xPy-4;
777 else min_xPy=target_xPy+4;
778 min_xPy=
std::max(min_xPy,bishop_xPy-1);
779 max_xPy=
std::min(max_xPy,bishop_xPy+1);
780 for(
int xPy=min_xPy;xPy<=max_xPy;xPy+=2){
781 int pos_x=(xPy+target_xMy)>>1;
782 int pos_y=(xPy-target_xMy)>>1;
784 Piece p1=state.pieceAt(pos);
792 if((
unsigned int)(target_xPy-bishop_xPy+2)>4u){
793 int pos_x=(bishop_xPy+target_xMy)>>1;
794 int pos_y=(bishop_xPy-target_xMy)>>1;
799 state.effectSetAt(pos).test(num)){
800 Piece p1=state.pieceAt(pos);
807 if((
unsigned int)(target_xMy-bishop_xMy+2)>4u){
808 int pos_x=(target_xPy+bishop_xMy)>>1;
809 int pos_y=(target_xPy-bishop_xMy)>>1;
814 state.effectSetAt(pos).test(num)
816 Piece p1=state.pieceAt(pos);
824 template<Player P,
class Action>
827 if(!state.hasPieceOnStand<
GOLD>(P))
return;
828 unsigned int gold_mask=spaces&((1<<
U)|(1<<
UR)|(1<<
UL)|(1<<
L)|(1<<
R)|(1<<
D));
829 if(gold_mask==0)
return;
830 generateDropDir<P,Action,U>(
target,action,gold_mask,
GOLD);
831 generateDropDir<P,Action,UL>(
target,action,gold_mask,
GOLD);
832 generateDropDir<P,Action,UR>(
target,action,gold_mask,
GOLD);
833 generateDropDir<P,Action,L>(
target,action,gold_mask,
GOLD);
834 generateDropDir<P,Action,R>(
target,action,gold_mask,
GOLD);
835 generateDropDir<P,Action,D>(
target,action,gold_mask,
GOLD);
837 template<Player P,
class Action>
840 if(!state.hasPieceOnStand<
SILVER>(P))
return;
841 unsigned int silver_mask=spaces&((1<<
U)|(1<<
UR)|(1<<
UL)|(1<<
DL)|(1<<
DR));
842 if(silver_mask ==0)
return;
844 generateDropDir<P,Action,DL>(
target,action,silver_mask,
SILVER);
845 generateDropDir<P,Action,DR>(
target,action,silver_mask,
SILVER);
846 generateDropDir<P,Action,U>(
target,action,silver_mask,
SILVER);
847 generateDropDir<P,Action,UL>(
target,action,silver_mask,
SILVER);
848 generateDropDir<P,Action,UR>(
target,action,silver_mask,
SILVER);
853 template<Player P,
class Action,
bool allEmpty>
858 if(allEmpty || state.pieceAt(pos).isEmpty())
859 action.dropMove(pos,
BISHOP,P);
862 if(allEmpty || state.pieceAt(pos).isEmpty())
863 action.dropMove(pos,
BISHOP,P);
866 if(allEmpty || state.pieceAt(pos).isEmpty())
867 action.dropMove(pos,
BISHOP,P);
870 if(allEmpty || state.pieceAt(pos).isEmpty())
871 action.dropMove(pos,
BISHOP,P);
874 template<Player P,
class Action,
bool allEmpty>
879 if(allEmpty || state.pieceAt(pos).isEmpty())
880 action.dropMove(pos,
ROOK,P);
883 if(allEmpty || state.pieceAt(pos).isEmpty())
884 action.dropMove(pos,
ROOK,P);
887 if(allEmpty || state.pieceAt(pos).isEmpty())
888 action.dropMove(pos,
ROOK,P);
891 if(allEmpty || state.pieceAt(pos).isEmpty())
892 action.dropMove(pos,
ROOK,P);
894 template<osl::Player P,
class Action>
899 assert(target==state.kingSquare(altP));
900 generateDir<P,0,Action,U>(state,
target,action,hasPawnCheckmate);
901 generateKnightAll<P,Action>(state,
target,action);
902 generateDir<P,2,Action,UL>(state,
target,action,hasPawnCheckmate);
903 generateDir<P,2,Action,UR>(state,
target,action,hasPawnCheckmate);
904 generateDir<P,1,Action,L>(state,
target,action,hasPawnCheckmate);
905 generateDir<P,1,Action,R>(state,
target,action,hasPawnCheckmate);
906 generateDir<P,1,Action,D>(state,
target,action,hasPawnCheckmate);
907 generateDir<P,2,Action,DL>(state,
target,action,hasPawnCheckmate);
908 generateDir<P,2,Action,DR>(state,
target,action,hasPawnCheckmate);
909 detail::generateRookLongMove<P,Action>(state,
target,action);
912 if(state.pinOrOpen(altP).test(num))
continue;
913 Piece p=state.pieceOf(num);
916 generateBishopLongMove<P,PBISHOP,Action>(state,target,action,p,num);
918 generateBishopLongMove<P,BISHOP,Action>(state,
target,action,p,num);
920 int spaces=
King8Info(state.Iking8Info(altP)).spaces();
921 generateDropGold<P,Action>(state,
target,action,spaces);
922 generateDropSilver<P,Action>(state,
target,action,spaces);
924 if(state.hasPieceOnStand<
BISHOP>(P)){
925 generateDropBishop<P,Action,true>(state,
target,action,
926 state.kingMobilityOfPlayer(altP,
UL),
927 state.kingMobilityOfPlayer(altP,
DR),
928 state.kingMobilityOfPlayer(altP,
UR),
929 state.kingMobilityOfPlayer(altP,
DL));
931 if(state.hasPieceOnStand<
ROOK>(P)){
933 l=state.kingMobilityOfPlayer(altP,
L);
934 r=state.kingMobilityOfPlayer(altP,
R);
935 d=state.kingMobilityOfPlayer(altP,
D);
936 u=state.kingMobilityOfPlayer(altP,
U);
937 generateDropRook<P,Action,true>(state,
target,action,l,r,d,u);
940 template<osl::Player P,
class Action>
944 CArray<unsigned char,8> pieceMobility;
945 PieceMask notPieceMask;
946 notPieceMask.setAll();
947 int num=state.pieceAt(target).number();
949 notPieceMask.reset(num);
951 generateDirNotKing<P,0,Action,U>(state,
target,action,pieceMobility,spaces,notPieceMask);
952 generateKnightAll<P,Action>(state,
target,action);
953 generateDirNotKing<P,2,Action,UL>(state,
target,action,pieceMobility,spaces,notPieceMask);
954 generateDirNotKing<P,2,Action,UR>(state,
target,action,pieceMobility,spaces,notPieceMask);
955 generateDirNotKing<P,1,Action,L>(state,
target,action,pieceMobility,spaces,notPieceMask);
956 generateDirNotKing<P,1,Action,R>(state,
target,action,pieceMobility,spaces,notPieceMask);
957 generateDirNotKing<P,1,Action,D>(state,
target,action,pieceMobility,spaces,notPieceMask);
958 generateDirNotKing<P,2,Action,DL>(state,
target,action,pieceMobility,spaces,notPieceMask);
959 generateDirNotKing<P,2,Action,DR>(state,
target,action,pieceMobility,spaces,notPieceMask);
961 generateRookLongMoveNotKing<P,Action>(state,
target,action,pieceMobility);
964 Piece p=state.pieceOf(num);
967 generateBishopLongMoveNotKing<P,PBISHOP,Action>(state,target,action,pieceMobility,p,num);
969 generateBishopLongMoveNotKing<P,BISHOP,Action>(state,
target,action,pieceMobility,p,num);
971 generateDropGold<P,Action>(state,
target,action,spaces);
972 generateDropSilver<P,Action>(state,
target,action,spaces);
973 if(state.hasPieceOnStand<
BISHOP>(P)){
979 generateDropBishop<P,Action,false>(state,
target,action,ul,dr,ur,dl);
981 if(state.hasPieceOnStand<
ROOK>(P)){
987 generateDropRook<P,Action,false>(state,
target,action,l,r,d,u);
991 template <
class Action>
992 template <osl::Player P,
bool isAttackToKing>
997 detail::template generateNotKing<P,Action>(state,
target,action);
1000 detail::template generateKing<P,Action>(state,
target,action,hasPawnCheckmate);
1003 template<
bool isAttackToKing>
1008 using namespace osl::move_action;