#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
char a[15][15]={" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" W ",
};
int sj[3],i,score=0,zb=4;
int life=1,jc=0,s=8,sum=0,m=0;
int rzb;
while(life!=0)
{
if(GetKeyState('0')<0)
{
break;
}
srand(time(NULL));
for(i=0;i<3;i++)
sj[i]=rand()%10;
a[0][sj[0]]='v';
a[0][sj[1]]='v';
a[0][sj[2]]='v';
Sleep(380);
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
//MessageBox(NULL,"←键"," ",MB_OK);
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
Sleep(5);
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
if(a[0][zb]=='v' || a[1][zb]=='v' || a[2][zb]=='v' || a[3][zb]=='v' || a[4][zb]=='v' || a[5][zb]=='v' || a[6][zb]=='v' || a[7][zb]=='v'/* || a[8][zb]=='v'*/)
{
rzb=zb;
while(jc==0)
{
s--;
if(a[s][rzb]=='v')
{
a[s][rzb]=' ';
jc=1;
score++;
}
else
{
a[s][rzb]='|';
Sleep(1);
sum++;
}
if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
{
if(GetKeyState(VK_LEFT)<0)
{
if(zb-1>=0)
{
zb--;
a[9][zb+1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
if(GetKeyState(VK_RIGHT)<0)
{
if(zb+1<=8)
{
zb++;
a[9][zb-1]=' ';
a[9][zb]='W';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
}
//getch();
}
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf("Your score:%d",score);
}
jc=0;
while(sum!=0)
{
a[m][rzb]=' ';
m--;
sum--;
}
m=7;
s=9;
}
if(a[8][zb]=='v')
{
life=0;
for(i=0;i<9;i++)
{
if(a[8][i]=='v')
a[9][i]='v';
a[8][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[7][i]=='v')
a[8][i]='v';
a[7][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[6][i]=='v')
a[7][i]='v';
a[6][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[5][i]=='v')
a[6][i]='v';
a[5][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[4][i]=='v')
a[5][i]='v';
a[4][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[3][i]=='v')
a[4][i]='v';
a[3][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[2][i]=='v')
a[3][i]='v';
a[2][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[1][i]=='v')
a[2][i]='v';
a[1][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[0][i]=='v')
a[1][i]='v';
a[0][i]=' ';
}
for(i=0;i<9;i++)
{
a[9][i]=' ';
}
a[9][zb]='X';
system("cls");
for(i=0;i<=9;i++)
puts(a[i]);
printf(" Game Over!!\nYour score: %d",score);
if(score>=66)
{
printf("\n Get password: cwcyarr");
Sleep(7500);
}
Sleep(2500);
continue;
}
for(i=0;i<9;i++)
{
if(a[8][i]=='v')
a[9][i]='v';
a[8][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[7][i]=='v')
a[8][i]='v';
a[7][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[6][i]=='v')
a[7][i]='v';
a[6][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[5][i]=='v')
a[6][i]='v';
a[5][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[4][i]=='v')
a[5][i]='v';
a[4][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[3][i]=='v')
a[4][i]='v';
a[3][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[2][i]=='v')
a[3][i]='v';
a[2][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[1][i]=='v')
a[2][i]='v';
a[1][i]=' ';
}
for(i=0;i<9;i++)
{
if(a[0][i]=='v')
a[1][i]='v';
a[0][i]=' ';
}
for(i=0;i<9;i++)
{
a[9][i]=' ';
}
a[9][zb]='W';
}
system("cls");
/*for(i=0;i<=9;i++)
puts(a[i]);*/
printf("\n\n\n Your score:%d",score);
if(score>=66)
{
printf("\n Get password: cwcyarr");
Sleep(7500);
}
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
return 0;
}
|