当前位置:首页 > 代码 > 正文

双人中国象棋源代码cwindows(象棋的编程代码公开)

admin 发布:2022-12-19 06:28 121


今天给各位分享双人中国象棋源代码cwindows的知识,其中也会对象棋的编程代码公开进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

急需用c语言写中国象棋的代码,只要红色方布局和走棋

接上面中国象棋代码:

if( check_turn == 12)    //相的走法规范

       { if((x == check_x y == check_y))

            {temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

              printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);

             }

         else if( x = 15 (abs(y - check_y) == 8 abs(x - check_x) == 4))

             {if((x == 22 (y == 11 || y == 27))||(x == 18

                ( y == 3 || y == 19 || y == 35)) ||(x == 14 (y == 11|| y ==27)))

                    { if( map[(x+check_x)/2][(y+check_y)/2] == '+')                                                  check_main1(temp,temp1,turn,turn1,num,if_return,map);

                      else {printf("棋子卡住,不可执行"); Sleep(500); }  }

                     else {printf("不合法的下法\n");Sleep(500); }

                  }

                else {printf("不合法的下法\n"); Sleep(500); }

              }

       if( check_turn == 13)    //士的走法规范

          { if((x == check_x y == check_y))

              {temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

               printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);  }

    else if( abs(x - check_x)== 2 abs( y - check_y) == 4 ((x==22 (y == 15

        || y == 23)) || ( x == 20 y == 19) || ( x == 18 ( y == 15 || y == 23))))                      {check_main1(temp,temp1,turn,turn1,num,if_return,map); }

     else { printf("不合法的下法\n"); Sleep(500); }   }

     if( check_turn == 14)    //将的走法规范

         { if((x == check_x y == check_y))

              { temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

                 printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);  }

else if( ((abs(x - check_x)== 2 abs( y - check_y) == 0 )|| (abs(x - check_x)== 0

  abs( y - check_y) == 4)) x = 18 x = 22 y = 15 y = 23 )

        { check_main1(temp,temp1,turn,turn1,num,if_return,map); }

           else { printf("不合法的下法\n"); Sleep(500); }   }

if( check_turn == 15)       //炮的走法规范

     { if((x == check_x y == check_y))

        {  temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

           printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);  }

       else if( y == check_y )

            { int check_pao = 0;

              if( x check_x)

                 { for(j = check_x + 2; j= x ;j = j+ 2)

                    { if(map[j][y] == '+' );  else  check_pao++;}

                  if(check_pao == 1 temp == '+')   // 直线行走但不可吃棋子                                 check_main1(temp,temp1,turn,turn1,num,if_return,map);

                else if( check_pao == 2 temp != '+')  //跳跃吃棋                                                 check_main1(temp,temp1,turn,turn1,num,if_return,map);

               else { printf("不合法的下法\n"); Sleep(500); }  }

            else { for(j = check_x - 2; j= x;j = j - 2)

             { if(map[j][y] == '+' );  else { check_pao++;} }

                if(check_pao == 1 temp == '+')   //直线行走但不可吃棋子                                  check_main1(temp,temp1,turn,turn1,num,if_return,map);

                 else if( check_pao == 2 temp != '+')   //跳跃吃棋                                            check_main1(temp,temp1,turn,turn1,num,if_return,map);

              else { printf("不合法的下法\n"); Sleep(500); }  }

             }

           else if( x == check_x )

             { int check_pao = 0;

                if( y check_y)

                   { for(j = check_y + 4; j= y ;j = j+4)

                      { if(map[x][j] == '+' );  else    check_pao++;}

                   if(check_pao == 1 temp == '+')  //直线行走但不可吃棋子                                   check_main1(temp,temp1,turn,turn1,num,if_return,map);

                 else if( check_pao == 2 temp != '+')   //跳跃吃棋                                                 check_main1(temp,temp1,turn,turn1,num,if_return,map);

                 else { printf("不合法的下法\n"); Sleep(500); }  }

              else {for(j = check_y - 4; j= y;j = j - 4)

                  {if(map[x][j] == '+' );  else  check_pao++;}

                     if(check_pao == 1 temp == '+')  //直线行走但不可吃棋子                                  check_main1(temp,temp1,turn,turn1,num,if_return,map);

               else if( check_pao == 2 temp != '+')   //跳跃吃棋                                                    check_main1(temp,temp1,turn,turn1,num,if_return,map);

               else { printf("不合法的下法\n"); Sleep(500); }  }

            }

          else { printf("不合法的下法\n");Sleep(500); }

         }

       if( check_turn == 16)    //卒的走法规范

          { if ( x = 14)

          { if((x == check_x y == check_y))

              {  temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

                 printf("三思而后行\n"); printf("还是你的回合");  Sleep(500);  }

    else if( x == check_x - 2 y == check_y)                                                     check_main1(temp,temp1,turn,turn1,num,if_return,map);

  else { printf("不合法的下法\n"); Sleep(500); }

}

else{ if((x == check_x y == check_y))

  {  temp = turn;  temp1 = turn1;  turn = 'O';  turn1 = 'N';  num--;

    printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);  }

else if((x - check_x == 0 abs(y-check_y) ==4) ||( x - check_x == -2

        abs(y-check_y) == 0))                                           check_main1(temp,temp1,turn,turn1,num,if_return,map);

else { printf("不合法的下法\n"); Sleep(500); }   }

  }

}

else  { if( check_turn == 20)  //车的走法规范 (帅方)

  { if((x == check_x y == check_y))

     {  temp = turn;  temp1 = turn1; turn = 'O'; turn1 = 'N';  num--;

        printf("三思而后行\n"); printf("还是你的回合"); Sleep(500);  }

else if( y == check_y )

     { if( x check_x)

       { for(j = check_x + 2; j x;j = j + 2)

         { if(map[j][y] == '+'); else {printf("不合法的下法\n"); Sleep(500); break; } }

  if( j = x) check_main2(temp,temp1,turn,turn1,num,if_return,map);

  }

if( x check_x)

    { for(j = check_x - 2; j x;j = j - 2)

       { if(map[j][y] == '+'); else { printf("不合法的下法\n"); Sleep(500); break; } }

if( j = x) check_main2(temp,temp1,turn,turn1,num,if_return,map);

}

}

else if(  x == check_x  )

   { if( y check_y)

     { for(j = check_y + 4; j y;j = j + 4)

      { if(map[x][j] == '+'); else { printf("不合法的下法\n"); Sleep(500); break; } }

   if( j = y) check_main2(temp,temp1,turn,turn1,num,if_return,map);

  }

if( y check_y)

   { for(j = check_y - 4; j y;j = j - 4)

     { if(map[x][j] == '+'); else { printf("不合法的下法\n");Sleep(500); break; } }

if( j = y) check_main2(temp,temp1,turn,turn1,num,if_return,map);

  }

}

else { printf("不合法的下法\n"); Sleep(500); }

}

if( check_turn == 21)    //马的走法规范

   { if((x == check_x y == check_y))

     { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

        printf("三思而后行\n");printf("还是你的回合"); Sleep(500); }

  else if( (abs( x - check_x) == 2 abs( y - check_y) == 8)

        map[check_x][(y+check_y)/2] =='+')

      { check_main2(temp,temp1,turn,turn1,num,if_return,map); }

else if( (abs( x - check_x) == 4 abs( y - check_y) == 4)

      map[(x + check_x)/2][check_y] == '+' )

   { check_main2(temp,temp1,turn,turn1,num,if_return,map); }

else { printf("不合法的下法\n");Sleep(500); }  }

  if( check_turn == 22)    //相的走法规范

   { if((x == check_x y == check_y))

      { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

         printf("三思而后行\n");printf("还是你的回合"); Sleep(500); }

     else if( x = 12 (abs(y - check_y) == 8 abs(x - check_x) == 4))

     { if((x == 4 (y == 11 || y == 27))||(x == 8 ( y == 3 || y == 19 || y == 35))

       ||(x == 12 (y == 11|| y ==27)))

       {  if( map[(x+check_x)/2][(y+check_y)/2] == '+')                                                   check_main2(temp,temp1,turn,turn1,num,if_return,map);

   else { printf("棋子卡住,不可执行");Sleep(500); }  }

else {printf("不合法的下法\n");Sleep(500); }

}

else { printf("不合法的下法\n");Sleep(500); }  }

if( check_turn == 23)    //士的走法规范

  { if((x == check_x y == check_y))

     { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

         printf("三思而后行\n");printf("还是你的回合"); Sleep(500);  }

   else if( abs(x - check_x)== 2 abs( y - check_y) == 4 ((x==4

(y == 15 || y == 23)) || ( x == 6 y == 19) || ( x == 8 ( y == 15 || y == 23))))

     { check_main2(temp,temp1,turn,turn1,num,if_return,map); }

     else { printf("不合法的下法\n");Sleep(500); }  }

  if( check_turn == 24)    //将的走法规范

   { if((x == check_x y == check_y))

      { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

         printf("三思而后行\n");printf("还是你的回合"); Sleep(500);  }

   else if( ((abs(x - check_x)== 2 abs( y - check_y) == 0 )|| (abs(x - check_x)== 0   abs( y - check_y) == 4)) x = 4 x = 8 y = 15 y = 23 )

   { check_main2(temp,temp1,turn,turn1,num,if_return,map); }

  else {printf("不合法的下法\n");Sleep(500); }  }

  if( check_turn == 25)    //炮的走法规范

     { if((x == check_x y == check_y))

         { temp = turn;  temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

             printf("三思而后行\n");printf("还是你的回合"); Sleep(500);  }

      else if( y == check_y )

          { int check_pao = 0;

            if( x check_x)

              { for(j = check_x + 2; j= x ;j = j+ 2)

                { if(map[j][y] == '+' );  else      check_pao++;}

                 if(check_pao == 1 temp == '+')   //直线行走但不可吃棋子                                 check_main2(temp,temp1,turn,turn1,num,if_return,map);

     else if( check_pao == 2 temp != '+')   //跳跃吃棋                                                       check_main2(temp,temp1,turn,turn1,num,if_return,map);

     else { printf("不合法的下法\n");Sleep(500); }  }

     else { for(j = check_x - 2; j= x;j = j - 2)

        { if(map[j][y] == '+' );  else { check_pao++;} }

            if(check_pao == 1 temp== '+')   //直线行走但不可吃棋子                                   check_main2(temp,temp1,turn,turn1,num,if_return,map);

       else if( check_pao == 2 temp != '+')   //跳跃吃棋                                                      check_main2(temp,temp1,turn,turn1,num,if_return,map);

    else { printf("不合法的下法\n");Sleep(500); }  }

  }

else if( x == check_x )

    { int check_pao = 0;

         if( y check_y)

            { for(j = check_y + 4; j= y ;j = j+4)

                { if(map[x][j] == '+' );  else check_pao++;}

           if(check_pao == 1 temp == '+')   //直线行走但不可吃棋                                              check_main2(temp,temp1,turn,turn1,num,if_return,map);

         else if( check_pao == 2 temp != '+')   //跳跃吃棋                                                 check_main2(temp,temp1,turn,turn1,num,if_return,map);

         else { printf("不合法的下法\n");Sleep(500); }  }

     else { for(j = check_y - 4 ; j= y;j = j - 4)

         { if(map[x][j] == '+' );  else  check_pao++;}

            if(check_pao ==1 temp == '+')   //直线行走但不可吃棋子                                     check_main2(temp,temp1,turn,turn1,num,if_return,map);

     else if( check_pao == 2 temp != '+')  //跳跃吃棋                                                       check_main2(temp,temp1,turn,turn1,num,if_return,map);

      else { printf("不合法的下法\n");Sleep(500); }  }

    }

  else { printf("不合法的下法\n");Sleep(500); }

   }

   if( check_turn == 26)  //卒的走法规范

      { if( x = 12)

        { if((x == check_x y == check_y))

          { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

             printf("三思而后行\n"); printf("还是你的回合"); Sleep(500); }

    else if( x == check_x + 2 y == check_y)                                               check_main2(temp,temp1,turn,turn1,num,if_return,map);

  else { printf("不合法的下法\n");Sleep(500); }  }

  else{ if((x == check_x y == check_y))

     { temp = turn; temp1 = turn1; turn = 'O'; turn1 = 'N'; num--;

        printf("三思而后行\n");printf("还是你的回合"); Sleep(500);  }

  else if((x - check_x == 0 abs(y-check_y) ==4) ||( x - check_x == 2

      abs(y-check_y) == 0))                                                       check_main2(temp,temp1,turn,turn1,num,if_return,map);

else { printf("不合法的下法\n");Sleep(500); }   }

   }

  }

}

}

system("cls");

if( if_return) return;

for(i = 0; i 27; i++)puts(map[i]);

}

Sleep(5000);

}

int main( )

{ while(1)

    { xiangqi( );

      printf("\n  重来,请按键.\n");

      getch( );

    }

  return 0;

}

中国象棋的源代码

中国象棋源代码blackleft(){ int x,y,n; if(blackcurpos.y0) { blackcurpos.y--; x=position[blacktemppos.x][blacktemppos.y].x; y=position[blacktemppos.x][blacktemppos.y].y; if(board[blacktemppos.x][blacktemppos.y]==0) drawbmp(x,y,boardfile[blacktemppos.x][blacktemppos.y]); else if(!(blacktemppos.x==blackoldpos.xblacktemppos.y==blackoldpos.yblackstate==MOVE)) { n=board[blacktemppos.x][blacktemppos.y]; drawbmp(x,y,chessfile[n]); } if(blacktemppos.x==blackoldpos.xblacktemppos.y==blackoldpos.yblackstate==MOVE) drawselecursor(blackoldpos); drawcursor(blackcurpos); blacktemppos.x=blackcurpos.x; blacktemppos.y=blackcurpos.y; }}blackright(){ int x,y,n; if(blackcurpos.y8) { blackcurpos.y++; x=position[blacktemppos.x][blacktemppos.y].x; y=position[blacktemppos.x][blacktemppos.y].y; if(board[blacktemppos.x][blacktemppos.y]==0) drawbmp(x,y,boardfile[blacktemppos.x][blacktemppos.y]); else if(!(blacktemppos.x==blackoldpos.xblacktemppos.y==blackoldpos.yblackstate==MOVE)) { n=board[blacktemppos.x][blacktemppos.y]; drawbmp(x,y,chessfile[n]); } if(blacktemppos.x==blackoldpos.xblacktemppos.y==blackoldpos.yblackstate==MOVE) drawselecursor(blackoldpos); drawcursor(blackcurpos); blacktemppos.x=blackcurpos.x; blacktemppos.y=blackcurpos.y; }}blackdo(){ int i,j,x,y,n; if(blackstate==SELECTblackcanselect()) { if(board[blackcurpos.x][blackcurpos.y]=BLACKboard[blackcurpos.x][blackcurpos.y]0) { blackstate=MOVE; drawselecursor(blackcurpos); blackoldpos.x=blackcurpos.x; blackoldpos.y=blackcurpos.y; } } else if(blackstate==MOVEblackcanmove()) { x=position[blackoldpos.x][blackoldpos.y].x; y=position[blackoldpos.x][blackoldpos.y].y; drawbmp(x,y,boardfile[blackoldpos.x][blackoldpos.y]); x=position[blackcurpos.x][blackcurpos.y].x; y=position[blackcurpos.x][blackcurpos.y].y; n=board[blackoldpos.x][blackoldpos.y]; drawbmp(x,y,chessfile[n]); if(board[blackcurpos.x][blackcurpos.y]==RED_JIANG) { winner=BLACK; finish=1; return; } board[blackcurpos.x][blackcurpos.y]=n; board[blackoldpos.x][blackoldpos.y]=0; for(i=0;i=2;i++) for(j=3;j=5;j++) if(board[i][j]==BLACK_JIANG) {x=i;y=j;} for(i=x+1,j=y,n=0;i=9;i++) { if(board[i][j]==RED_JIANGn==0) {winner=RED;finish=1;break;} else if(board[i][j]!=0) n++; } turn=RED; redstate=SELECT; drawcursor(redcurpos); drawbmp(30,438,"bmp\\rzq.wfb"); /*转交控制权给红方*/ } }blackundo(){ int x,y,n; if(blackstate==MOVE) { x=position[blackoldpos.x][blackoldpos.y].x; y=position[blackoldpos.x][blackoldpos.y].y; n=board[blackoldpos.x][blackoldpos.y]; drawbmp(x,y,chessfile[n]); blackoldpos.x=blackcurpos.x; blackoldpos.y=blackcurpos.y; drawcursor(blackcurpos); blackstate=SELECT; }}/*----------------------------------------------------*/start(){ drawcursor(blackcurpos); drawbmp(30,438,"bmp\\bzq.wfb"); while(!finish) { key=getkey(); switch(key){ case RED_UP: if(turn==RED) redup(); break; case RED_DOWN: if(turn==RED) reddown(); break; case RED_LEFT: if(turn==RED) redleft(); break; case RED_RIGHT: if(turn==RED) redright(); break; case RED_DO: if(turn==RED) reddo(); break; case RED_UNDO: if(turn==RED) redundo(); break; case BLACK_UP: if(turn==BLACK) blackup(); break; case BLACK_DOWN: if(turn==BLACK) blackdown(); break; case BLACK_LEFT: if(turn==BLACK) blackleft(); break; case BLACK_RIGHT: if(turn==BLACK) blackright(); break; case BLACK_DO: if(turn==BLACK) blackdo(); break; case BLACK_UNDO: if(turn==BLACK) blackundo(); break; case ESCAPE: finish=1;break; } }}main(){ init(); initpos(); initchessmap(); drawbmp(0,0,"bmp\\board.wfb"); initdrawchess(); /*初始化光标位置*/ redcurpos.x=redoldpos.x=redtemppos.x=9; redcurpos.y=redoldpos.y=redtemppos.y=8; blackcurpos.x=blackoldpos.x=blacktemppos.x=0; blackcurpos.y=blackoldpos.y=blacktemppos.y=0;/*开始*/ start(); if(winner==RED) drawbmp(200,200,"bmp\\redwin.wfb"); else if(winner==BLACK) drawbmp(200,200,"bmp\\blackwin.wfb"); else drawbmp(200,200,"bmp\\exit.wfb"); getch(); end();}

用C语言输出中国象棋棋盘的源代码!!急!急!急!

#include stdio.h

void main()

{int r=0;

int c=0;

int star_one=10;

for(r=0;r=star_one*9;r+=2)

{ for(c=0;c=star_one*8;c++)

{if((r%star_one==0 || c%star_one==0)c%2==0 (r=star_one*4 || r=star_one*4+star_one) || (r=star_one*4 r=star_one*4+star_one (c==0 || c==star_one*8)))

{printf("%c",'*');}

else

{printf("%c",' ');}

}

printf("\n");

}

}

急求C++设计象棋打谱程序的源代码

这是一个简单的程序,会自动计算提子,但不会数目。其它的运行一次估计就差不多会用了。稍微写了点注释。

#includestdio.h

#includestdlib.h

char board[21][21];

char move[5][2]=,,,,};

void initBoard();//初始化棋盘

void showBoard();//输出棋盘

char set(int x,int y,char color);//下子

void process(int xx,int yy);//计算提子

int main()

{

FILE * fptr=NULL;

char pufile[256]=;

char op;

int s;

int x,y,r;

char color;

char win;

int cnt;

start:

s=8;

while(s!=1 s!=2)

{

printf("选择模式:\n1---下棋\n2---看棋谱\n0---退出\n");

printf("下棋模式下,下子请输入s x y(x,y为位置),认输输入g,和棋输入h\n选择:");

scanf("%d",s);

if(s==0) return 0;

//Egg1

if(s==10) printf("Programmer: swordlance :)\n");

//Egg1 end

}

getchar();

printf("输入棋谱路径:");

gets(pufile);

if(s==1) fptr=fopen(pufile,"w");

else fptr=fopen(pufile,"r");

if(!fptr)

{

printf("文件无法打开(创建)!\n");

system("PAUSE");

return -1;

}

initBoard();

cnt=0;

color='B';

while(op!='g')

{

system("CLS");

showBoard();

printf("(第%d手)",++cnt);

if(s==1)

{

printf("%c 方:",color);

scanf("%c",op);

//printf("[%c]",op);

if(op=='s')

{

scanf("%d %d",x,y);

getchar();

if(set(x,y,color)!=0)

{

printf("该处不能落子!\n");

cnt--;

system("PAUSE");

}

else

{

process(x,y);

fprintf(fptr,"%d %d\n",x,y);

if(color=='B') color='W';

else color='B';

}

}

else if(op=='g')

{

printf("%c 方认输。\n",color);

if(color=='B') fprintf(fptr,"0 1\n");

else fprintf(fptr,"0 -1\n");

fflush(fptr);

fclose(fptr);

system("PAUSE");

goto start;

}

else if(op=='h')

{

printf("和棋。\n");

fprintf(fptr,"0 0\n");

fflush(fptr);

fclose(fptr);

system("PAUSE");

goto start;

}

else

{

printf("参数错误,下子请输入s x y(x,y为位置),认输输入 g,和棋输入h");

cnt--;

system("PAUSE");

}

}

else

{

fscanf(fptr,"%d %d",x,y);

if(x==0)

{

if(y0) printf("W 方胜!\n");

else if(y0) printf("B 方胜!\n");

else printf("和棋!\n");

system("PAUSE");

goto start;

}

else

{

printf("%c 方落子(%d,%d)\n",color,x,y);

set(x,y,color);

process(x,y);

if(color=='B') color='W';

else color='B';

}

system("PAUSE");

}

}

system("PAUSE");

return 0;

}

void initBoard()

{

int i,j;

board[0][0]='O';

for(i=1;i=19;i++) board[0][i]='-';

board[0][20]='O';

for(i=1;i=19;i++)

{

board[i][0]='|';

for(j=1;j=19;j++) board[i][j]='+';

board[i][20]='|';

}

board[20][0]='O';

for(i=1;i=19;i++) board[20][i]='-';

board[20][20]='O';

board[4][4]=board[4][10]=board[4][16]=

board[10][4]=board[10][10]=board[10][16]=

board[16][4]=board[16][10]=board[16][16]='*';

}

void showBoard()

{

int i,j;

for(i=0;i=20;i++)

{

for(j=0;j=20;j++)

{

printf("%c",board[i][j]);

}

printf("\n");

}

}

char set(int x,int y,char color)

{

if(board[x][y]=='W' || board[x][y]=='B') return -1;//不能落子

else board[x][y]=color;

return 0;

}

//计算提子

void process(int xx,int yy)

{

char his[21][21]=;//记录算过的棋子以节约效率

char Q[400][2]=;//某一片棋

int e;//Q的长度。

char mcolor;//这片棋的颜色

char ecolor;//另一种颜色

int QI=0;//气数

int i,j,k,l,m;

int x,y;

for(m=0;m5;m++)

{

i=xx+move[m][0];//为了能够完成打劫,先算别人再算自己

j=yy+move[m][1];

if(his[i][j]==0 (board[i][j]=='W' || board[i][j]=='B')) //该位置有子开始算气

{

QI=0;

his[i][j]=1;

mcolor=board[i][j];

ecolor=(board[i][j]=='W'?'B':'W');

//printf("m=%c e=%c\n",mcolor,ecolor);

Q[0][0]=i;

Q[0][1]=j;

e=1;

for(k=0;ke;k++)

{

for(l=0;l4;l++)

{

x=Q[k][0]+move[l][0];

y=Q[k][1]+move[l][1];

//printf("x=%d y=%d\n",x,y);

//system("PAUSE");

if(x0 y0 x20 y20 his[x][y]==0)

{

if(board[x][y]==mcolor)//己方,长气

{

Q[e][0]=x;

Q[e][1]=y;

e++;

his[x][y]=1;

}

else

{

if(board[x][y]=='+') QI++; //空地,加气,忽略重复计算

}

}

}

}

//printf("QI=%d\n",QI);

//system("PAUSE");

if(!QI)//死棋,提子

{

for(k=0;ke;k++)

{

board[Q[k][0]][Q[k][1]]='+';

his[Q[k][0]][Q[k][1]]=0;

}

}

}

}

}

双人中国象棋源代码cwindows的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于象棋的编程代码公开、双人中国象棋源代码cwindows的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/3828.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载