Congratulations mine clearance but will not

#include <stdio.h>
#include <stdlib.h>
#include <WINDOWS.H>
#include <the conio.h>
int main ()
{
the printf ( "press up and down to control wsad \ n-");
the printf ( "press p to q labeled mine to mine \ n");

char b[10][10]={"#####",
"#####",
"#####",
"#####",
"#####",
};
int x=0,y=0,score=0;
char ch;
for(int i=0;i<5;i++)
puts(b[i]);
while(b[0]!="++++p"||b[1]!="+p+++"||b[2]!="+++++"||b[3]!="+++p+"||b[4]!="+++++")
{
ch=getch();
if(ch=='s')
x++;
/* {
if(b[x+1][y]=='#'||b[x+1][y]=='p'||b[x+1][y]=='+')
{
if(b[x][y]=='p')
{
b[x][y]='p';
x++;
b[x][y]='o';
}

if(b[x][y]=='+')
{
b[x][y]='+';
x++;
b[x][y]='o';
}
if(b[x][y]=='o')
{
b[x][y]='#';
x++;
b[x][y]='o';
}
}
}*/

if(ch=='w')
x--;
/* {
if(b[x-1][y]=='#'||b[x-1][y]=='p'||b[x-1][y]=='+')
{

if(b[x][y]=='o')
{
b[x][y]='#';
x--;
b[x][y]='o';
}
if(b[x][y]=='+')
{
b[x][y]='+';
x--;
b[x][y]='o';
}
if(b[x][y]=='p')
{
b[x][y]='p';
x--;
b[x][y]='o';
}
}
}*/

if(ch=='a')
y--;
/* {
if(b[x][y-1]=='#'||b[x][y-1]=='p'||b[x][y-1]=='+')
{
if(b[x][y]=='o')
{
b[x][y]='#';
y--;
b[x][y]='o';
}
if(b[x][y]=='+')
{
b[x][y]='+';
y--;
b[x][y]='o';
}
if(b[x][y]=='p')
{
b[x][y]='p';
y--;
b[x][y]='o';
}
}
}*/

if(ch=='d')
y++;
/* {
if(b[x][y+1]=='#'||b[x][y+1]=='p'||b[x][y+1]=='+')
{
if(b[x][y]=='o')
{
b[x][y]='#';
y++;
b[x][y]='o';
}
if(b[x][y]=='+')
{
b[x][y]='+';
y++;
b[x][y]='o';
}
if(b[x][y]=='p')
{
b[x][y]='p';
y++;
b[x][y]='o';
}
}
}*/
if(ch=='p')
{
b[x][y]='p' ;
}

if(ch=='q')
{
if(x==0&&y==4||x==1&&y==1||x==3&&y==3)
{
system("cls");
b[x][y]='o';
for(int i=0;i<5;i++) puts(b[i]);

Sleep(1000);
printf("踩到雷了 游戏结束");
score++;
break;
}

else
{
b[x][y]='+';
}


}
system("cls");

for( int i=0;i<5;i++)
puts(b[i]);

}
if(score==0) printf("恭喜你 胜利啦");

return 0;
}

Guess you like

Origin www.cnblogs.com/Cathycat/p/11272765.html