C语言编写象棋程序代码(9)
发布时间:2021-06-08
发布时间:2021-06-08
可编辑
return 0;
}
break;
case RED_JIANG: /*完成*/ if(x!=oldx&&y!=oldy) return 0;
if(x!=oldx)
if((x-oldx)>1||(oldx-x)>1) return 0;
else if(x<7) return 0;
else if(y!=oldy)
if((y-oldy)>1||(oldy-y)>1) return 0;
else if(y<3||y>5) return 0;
break;
case RED_JU: /*完成*/ if(x!=oldx&&y!=oldy) return 0;
else 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;
}
break;
case RED_MA: /*完成*/ if((x-oldx)==2&&((y-oldy)==1||(oldy-y)==1))
{
if(board[oldx+1][oldy]!=0) return 0;
}else
if((oldx-x)==2&&((y-oldy)==1||(oldy-y)==1))
{
if(board[oldx-1][oldy]!=0) return 0;
}else
if((y-oldy)==2&&((x-oldx)==1||(oldx-x)==1))
{
if(board[oldx][oldy+1]!=0) return 0;
}else
if((oldy-y)==2&&((x-oldx)==1||(oldx-x)==1))
{
if(board[oldx][oldy-1]!=0) return 0;
.