#include <iostream>
#include<windows.h>
#include<conio.h>
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
int kk;
char qiang0[31]="qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
char qiang1[31]="q q# q";
char qiang2[31]="qqqqqq qqqqqqq qqqqqqqqq qqq q";
char qiang3[31]="q #q qqqqq#q qqqqqq#qq #q q";
char qiang4[31]="q qqqq q qqqqqq q";
char qiang5[31]="q qqqqqqqqq qqq qqqqqqqqqqq q";
char qiang6[31]="qq qqqqqq qq qqqq q";
char qiang7[31]="qqqq qq qqqqqq qqqq q qqq";
char qiang8[31]="qqqq qqqqq q w";
char qiang9[31]="qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
int xy[2]={1,1}; // x,y x(0~19)right y(1~8)under
bool running=1;
void caozuo(int xy1[2])
{
int x1=xy1[0],y1=xy1[1];
if (y1==1)
qiang1[x1]='.';
else if (y1==2)
qiang2[x1]='.';
else if (y1==3)
qiang3[x1]='.';
else if (y1==4)
qiang4[x1]='.';
else if (y1==5)
qiang5[x1]='.';
else if (y1==6)
qiang6[x1]='.';
else if (y1==7)
qiang7[x1]='.';
else if (y1==8)
qiang8[x1]='.';
}
void qingchu(int xy5[2])
{
int x2=xy5[0],y2=xy5[1];
if (y2==1)
qiang1[x2]=' ';
else if (y2==2)
qiang2[x2]=' ';
else if (y2==3)
qiang3[x2]=' ';
else if (y2==4)
qiang4[x2]=' ';
else if (y2==5)
qiang5[x2]=' ';
else if (y2==6)
qiang6[x2]=' ';
else if (y2==7)
qiang7[x2]=' ';
else if (y2==8)
qiang8[x2]=' ';
}
void qingchu2(int xy5[2])
{
int x2=xy5[0],y2=xy5[1];
if (y2==1)
qiang1[x2]='q';
else if (y2==2)
qiang2[x2]='q';
else if (y2==3)
qiang3[x2]='q';
else if (y2==4)
qiang4[x2]='q';
else if (y2==5)
qiang5[x2]='q';
else if (y2==6)
qiang6[x2]='q';
else if (y2==7)
qiang7[x2]='q';
else if (y2==8)
qiang8[x2]='q';
}
int tiqu(int xy6[2],int xy7[2])
{
int x5=xy6[0];
int y5=xy6[1];
char aaa;
if (y5==0)
aaa=qiang0[x5];
else if (y5==1)
aaa=qiang1[x5];
else if (y5==2)
aaa=qiang2[x5];
else if (y5==3)
aaa=qiang3[x5];
else if (y5==4)
aaa=qiang4[x5];
else if (y5==5)
aaa=qiang5[x5];
else if (y5==6)
aaa=qiang6[x5];
else if (y5==7)
aaa=qiang7[x5];
else if (y5==8)
aaa=qiang8[x5];
else if (y5==9)
aaa=qiang9[x5];
if (aaa==' ')
return 3;
else if (aaa=='w')
running=0;
else if (aaa=='q')
{
xy[0]=xy7[0];
xy[1]=xy7[1];
return 2;
}
else if (aaa=='#')
{
running=0;
kk=1;
}
}
int yidong(int xy2[2],int yzy1[2],int mode)
{
if (mode==2)
{
int x4=xy2[0],y4=xy2[1];
if (xy2[1]>0 && xy2[1]<9 && xy2[0]>=0 && xy2[0]<30)
{
int a3=tiqu(xy2,yzy1);
if (a3==3)
{
qingchu(yzy1);
caozuo(xy2);
}
}
}
}
void check(int xy3[2])
{
char ch;
int x3=xy3[0];
int y3=xy3[1];
int yxy[2]={x3,y3};
ch = getch();
if (ch == -32)
{
ch = getch();
switch (ch)
{
case 72:
xy[1]-=1;
break;
case 80:
if (xy[1]!=8){
xy[1]+=1;
break;
}
case 75:
xy[0]-=1;
break;
case 77:
xy[0]+=1;
break;
default:
break;
}
}
yidong(xy3,yxy,2);
}
void dayin()
{
cout << qiang0 << endl;
cout << qiang1 << endl;
cout << qiang2 << endl;
cout << qiang3 << endl;
cout << qiang4 << endl;
cout << qiang5 << endl;
cout << qiang6 << endl;
cout << qiang7 << endl;
cout << qiang8 << endl;
cout << qiang9 << endl;
cout << xy[0] << ","<< xy[1] << endl;
}
int main()
{
int sc;
yidong(xy,xy,2);
while (running)
{
dayin();
//xunhuan(xy);
check(xy);
Sleep(100);
cout<< "a" << endl;
sc+=1;
system("cls");
}
if (kk==1)
{
system("cls");
cout << "YOU DIE" << endl;
}
else
{
system("cls");
cout << "YOU WIN" << endl;
if (sc<=45)
cout << "金奖" << endl;
else if (sc<=60)
cout << "银奖" << endl;
else
cout << "铜奖" << endl;
}
return 0;
}