|
|
|
@ -69,13 +69,17 @@ void startgame() //
|
|
|
|
|
scanf("%d%d",&x,&y);
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(p[x][y]," ")==0)//判断棋盘位置是否已有棋子
|
|
|
|
|
if(x>=0&&x<=18&&y>=0&&y<=18)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(p[x][y]," ")==0)//判断棋盘位置是否已有棋子
|
|
|
|
|
{
|
|
|
|
|
strcpy(p[x][y],"●");//没有则下黑棋
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf(" 您不能在此位置落子,请重新输入坐标:");//已有棋子则提示用户重新落子
|
|
|
|
|
}
|
|
|
|
|
else printf(" 输入的坐标超过了棋盘范围");
|
|
|
|
|
scanf("%d%d",&x,&y);
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
@ -101,13 +105,17 @@ void white() //
|
|
|
|
|
scanf("%d%d",&x,&y);
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(p[x][y]," ")==0)//判断此位置是否有棋
|
|
|
|
|
if(x>=0&&x<=18&&y>=0&&y<=18)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(p[x][y]," ")==0)//判断棋盘位置是否已有棋子
|
|
|
|
|
{
|
|
|
|
|
strcpy(p[x][y],"○");//没有则下白棋
|
|
|
|
|
strcpy(p[x][y],"○");//没有则下黑棋
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf(" 您不能在此位置落子,请重新输入坐标:");//有棋则提示重新输入
|
|
|
|
|
printf(" 您不能在此位置落子,请重新输入坐标:");//已有棋子则提示用户重新落子
|
|
|
|
|
}
|
|
|
|
|
else printf(" 输入的坐标超过了棋盘范围");
|
|
|
|
|
scanf("%d%d",&x,&y);
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|