#include"wz.h"/*int check3(int x[][5]){ int i,j; int sum=0;for(i=0;i<5;i++) { for(j=0;j<5;j++) sum+=x[i][j]; }if(sum==1) return 1;else return 0;}*/int check3(int x[][5]){ int i,j; for(i=0;i<5;i++) { for(j=0;j<5;j++) if(x[i][j]==1)return 1; break; } return 0;}void show(int x[][5]){ int i,j; for(i=0;i<5;i++) { for(j=0;j<5;j++) printf("%2d",x[i][j]); printf("\n"); } }void play(int v[][5],int x,int y){ v[x][y]=1-v[x][y]; if(x==0&&y==0){ v[x][y+1]=1-v[x][y+1];v[x+1][y]=1-v[x+1][y];} if(x==0&&y==4){ v[x][y-1]=1-v[x][y-1];v[x+1][y]=1-v[x+1][y];} if(x==4&&y==0){ v[x][y+1]=1-v[x][y+1];v[x-1][y]=1-v[x-1][y];} if(x==4&&y==4){ v[x][y-1]=1-v[x][y-1];v[x-1][y]=1-v[x-1][y];} if(x==0&&y!=0&&y!=4) { v[x][y-1]=1-v[x][y-1]; v[x][y+1]=1-v[x][y+1]; v[x+1][y]=1-v[x+1][y]; } if(x!=0&&x!=4&&y==4) { v[x-1][y]=1-v[x-1][y]; v[x][y-1]=1-v[x][y-1]; v[x+1][y]=1-v[x+1][y]; } if(x==4&&y!=0&&y!=4) { v[x][y+1]=1-v[x][y+1]; v[x][y-1]=1-v[x][y-1]; v[x-1][y]=1-v[x-1][y]; } if(x=!4&&x!=0&&y==0) { v[x][y+1]=1-v[x][y+1]; v[x+1][y]=1-v[x-1][y]; v[x-1][y]=1-v[x-1][y]; } else {v[x-1][y]=1-v[x-1][y];v[x][y-1]=1-v[x][y-1];v[x+1][y]=1-v[x+1][y];v[x][y+1]=1-v[x][y+1]; }}main(){int v[5][5]={1};int i,j,state=0;int x,y;int m=0;show(v);if(check3(v))printf("wzzx\n");while(check3(v)>0) { printf("ckeack is %d\n",check3(v)); //printf("enter x and y\n"); //scanf("%d",&x); scanf("%d",&y); scanf("%d",&m); x=m/10; y=m%5; printf(" (%d,%d)\n",x,y);if(x>=0&&x<5&&y>=0&&y<5) {play(v,x,y); show(v);} else { printf("error ,play again \n"); } }}
if语句 应该有问题 输出与预期不一致