0
回答
cocos2d中平行的for循环问题
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

几个平行的for循环,循环一个后想要结束所有的for循环,暂时没想法,求教?????

 

 

for (x1=(i+1);i<=x1<=7;x1++)

     {  
      if (chess[x1][j]==1)
      {
       a=(x1-i)/abs(x1-i);
       for (d=1;d<abs(x1-i);d++)

       {    
        if (chess[i+a*d][j]!=2)
        {
         h=2;
         break;
        }
       }

       if (h==0)
       {
                               for (d=1;d<=abs(x1-i);d++)

        {
         chess[i+a*d][j]=1;
        }
        ondraw();
        break;
       }
       else
       {
        MessageBoxA(
         NULL,
         "不可走棋!",
         "游戏提示!",
         MB_OKCANCEL);
        chess[i][j]=0;
        c--;
        break;
       }
      }

     }
     
//////-----------------------------------------------------------------------
     for (x1=(i-1);0<=x1<=i;x1--)

     {  
      if (chess[x1][j]==1)
      {
       a=(x1-i)/abs(x1-i);
       for (d=1;d<abs(x1-i);d++)

       {    
        if (chess[i+a*d][j]!=2)
        {
         h1=2;
         break;
        }
       }

       if (h1==0)
       {
        for (d=1;d<=abs(x1-i);d++)

        {
         chess[i+a*d][j]=1;
        }
        ondraw();
        break;
       }
       else
       {
        MessageBoxA(
         NULL,
         "不可走棋!",
         "游戏提示!",
         MB_OKCANCEL);
        chess[i][j]=0;
        c--;
        break;
       }
      }

     }

    /////------------------------------------------------------------------------              
     for (y1=(j+1);j<=y1<=7;y1++)

     {  
      if (chess[i][y1]==1)
      {
       a=(y1-j)/abs(y1-j);
       for (d=1;d<abs(y1-j);d++)

       {    
        if (chess[i][j+a*d]!=2)
        {
         h2=2;
         break;
        }
       }

       if (h2==0)
       {
        for (d=1;d<=abs(y1-j);d++)

        {
         chess[i][j+a*d]=1;
        }
        ondraw();
        break;
       }
       else
       {
        MessageBoxA(
         NULL,
         "不可走棋!",
         "游戏提示!",
         MB_OKCANCEL);
        chess[i][j]=0;
        c--;
        break;
       }
      }

     }

/////---------------------------------------------------------------------------
     for (y1=(j-1);0<=y1<=j;y1--)

     {  
      if (chess[i][y1]==1)
      {
       a=(y1-j)/abs(y1-j);
       for (d=1;d<abs(y1-j);d++)

       {    
        if (chess[i][j+a*d]!=2)
        {
         h3=2;
         break;
        }
       }

       if (h3==0)
       {
        for (d=1;d<=abs(y1-j);d++)

        {
         chess[i][j+a*d]=1;
        }
        ondraw();
        break;
       }
       else
       {
        MessageBoxA(
         NULL,
         "不可走棋!",
         "游戏提示!",
         MB_OKCANCEL);
        chess[i][j]=0;
        c--;
        break;
       }
      }

 

<无标签>
举报
zhuceliyang
发帖于5年前 0回/144阅
顶部