可编辑
/*----------------------------------------------------*/
int getkey()
{
int press;
while(bioskey(1) == 0);
press=bioskey(0);
press=press&0xff00;
return(press);
}
/*--------------------红方操作--------------------*/
int redcanselect()
{
int x,y;
x=redcurpos.x;
y=redcurpos.y;
if(board[x][y]>=RED_JU&&board[x][y]<=RED_BIN)
return 1;
else
return 0;
}
int redcanmove()
{
int i,j,min,max,oldx,oldy,x,y;
oldx=redoldpos.x;
oldy=redoldpos.y;
x=redcurpos.x;
y=redcurpos.y;
/*case1 目标位置是否是自己人*/
if(board[x][y]>=RED_JU&&board[x][y]<=RED_BIN)
return 0;
/* 军、马、炮、相、士、将、卒的走法正确性的判断*/
switch(board[oldx][oldy])
{
case RED_BIN: /*完成*/ if(oldx>=5)
{ if(y!=oldy||(oldx-x)!=1) return 0;}
else
{ if(x==(oldx-1)&&y==oldy) return 1;
else
if(x==oldx&&y==(oldy+1)) return 1;
else
if(x==oldx&&y==(oldy-1)) return 1;
else
.