C语言编写象棋程序代码(10)
发布时间:2021-06-08
发布时间:2021-06-08
可编辑
}else
return 0;
break;
case RED_PAO: /*完成*/ if(x!=oldx&&y!=oldy) return 0;
if(board[x][y]==0)
{
if(x!=oldx)
{ min=(x>oldx)?oldx:x;
max=(x>oldx)?x:oldx;
for(i=min+1;i<max;i++)
if(board[i][y]!=0) return 0;
}
else if(y!=oldy)
{ min=(y>oldy)?oldy:y;
max=(y>oldy)?y:oldy;
for(i=min+1;i<max;i++)
if(board[x][i]!=0) return 0;
}
}
else
{
if(x!=oldx)
{ min=(x>oldx)?oldx:x;
max=(x>oldx)?x:oldx;
for(i=min+1,j=0;i<max;i++)
if(board[i][y]!=0) j++;
if(j!=1) return 0;
}
else if(y!=oldy)
{ min=(y>oldy)?oldy:y;
max=(y>oldy)?y:oldy;
for(i=min+1,j=0;i<max;i++)
if(board[x][i]!=0) j++;
if(j!=1) return 0;
}
}
break;
case RED_SHI: /*完成*/ if(oldx==9||oldx==7)
{if(x!=8||y!=4) return 0;}
else if(oldx==8)
{if(x==9&&y==3) return 1;
else
.