6   namespace move_generator
 
   15     return dx0*dy1==dx1*dy0;
 
   26     if(std::abs(dx)>8 || std::abs(dy)>8) 
return false;
 
   37     if(std::abs(dx)>8 || std::abs(dy)>8) 
return false;
 
   48     if(std::abs(dx)>8 || std::abs(dy)>8) 
return false;
 
   60     if(ptype==
KING) 
continue;
 
   63       for(
int y=1;y<=9;y++){
 
   66         for(
int x1=1;x1<=9;x1++)
 
   67           for(
int y1=1;y1<=9;y1++){
 
   69             if(pos==pos1)
continue;
 
   72             for(
int dx0=-1;dx0<=1;dx0++)
 
   73               for(
int dy0=-1;dy0<=1;dy0++){
 
   74                 int x2=x+dx0,y2=y+dy0;
 
   96       for(
int y=1;y<=9;y++){
 
   98         int sIndex=0,dIndex=0,index1=0,index2=0;
 
   99         for(
int x1=1;x1<=9;x1++)
 
  100           for(
int y1=1;y1<=9;y1++){
 
  102             if(pos==pos1)
continue;
 
  106               Square pos2(x+(x1-x)*2,y+(y1-y)*2);
 
  108               longDropDirect[ptype](pos.
index(),dIndex++)=
Offset(x1-x,y1-y);
 
  112             CArray<int,2> dxs, dys;
 
  113             for(
int dx0=-1;dx0<=1;dx0++)
 
  114               for(
int dy0=-1;dy0<=1;dy0++){
 
  115                 int x2=x+dx0,y2=y+dy0;
 
  117                 if(pos2==pos) 
continue;
 
  125               if(abs(x-x1)<=1 && abs(y-y1)<=1)
 
  126                 dropSquare[ptype](pos.
index(),sIndex++)=pos1;
 
  128                 longDropSquare[ptype](pos.
index(),index1++)=
 
  132                 longDrop2Square[ptype](pos.
index(),index2++)=
 
  147     for(
int dx=-8;dx<=8;dx++)
 
  148       for(
int dy=-8;dy<=8;dy++){
 
  149         if(dx==0 && dy==0) 
continue;
 
  154         for(
int dx1=-1;dx1<=1;dx1++){
 
  155           for(
int dy1=-1;dy1<=1;dy1++){
 
  156             if(dx1==0 && dy1==0) 
continue;
 
  159               int div=
std::max(std::abs(dx1-dx),std::abs(dy1-dy));
 
  161               if(abs(dx1+(dx-dx1)/div)>1 ||
 
  162                  abs(dy1+(dy-dy1)/div)>1){
 
  163                 betweenOffset[ptype][o32.
index()]=
 
  165                              Offset((dx1-dx)/div,(dy1-dy)/div));
 
  170         int sIndex=0,lIndex=0,spIndex=0;
 
  171         for(
int dx0=-8;dx0<=8;dx0++)
 
  172           for(
int dy0=-8;dy0<=8;dy0++){
 
  173             if(dx0==0 && dy0==0) 
continue;
 
  175             if(!
hasEffect(ptype,dx0-dx,dy0-dy)) 
continue;
 
  176             int effectDx=9,effectDy=9;
 
  177             bool unblockableEffect=
false;
 
  179             bool promotedUnblockableEffect=
false;
 
  180             for(
int dx1=-1;dx1<=1;dx1++){
 
  181               for(
int dy1=-1;dy1<=1;dy1++){
 
  182                 if(dx1==0 && dy1==0) 
continue;
 
  188                       (abs(dx0)<=1 && abs(dy0)<=1)
 
  190                     unblockableEffect=
true;
 
  194                 else if(
hasEffect(ptype,dx1-dx0,dy1-dy0) &&
 
  196                   if(std::abs(effectDx)>=std::abs(dx1-dx0) &&
 
  197                      std::abs(effectDy)>=std::abs(dy1-dy0)){
 
  198                     effectDx=dx1-dx0; effectDy=dy1-dy0;
 
  209                   promotedUnblockableEffect=
true;
 
  216               shortMoveOffset[ptype](o32.
index(),sIndex++)=
Offset(dx0,dy0);
 
  220               longMoveOffset[ptype](o32.
index(),lIndex++)=
 
  223             if(promotedUnblockableEffect 
 
  226               shortPromoteMoveOffset[ptype](o32.
index(),spIndex++)=
 
  236   initLongDropSquare();