|
|
|
@ -23,12 +23,9 @@ struct Tetris
|
|
|
|
|
int score; //游戏的分数
|
|
|
|
|
int level; //游戏的等级
|
|
|
|
|
} ;
|
|
|
|
|
struct jilu_info
|
|
|
|
|
{
|
|
|
|
|
int first;
|
|
|
|
|
int second;
|
|
|
|
|
int third;
|
|
|
|
|
}jilu={0,0,0};
|
|
|
|
|
int first;
|
|
|
|
|
int second;
|
|
|
|
|
int third;
|
|
|
|
|
HANDLE hOut; //控制台句柄
|
|
|
|
|
/****函数声明****/
|
|
|
|
|
void HideCursor(); //隐藏光标
|
|
|
|
@ -45,7 +42,7 @@ void Clean(struct Tetris *); //
|
|
|
|
|
int If_move(struct Tetris *); //判断是否能移动,1动;0不动
|
|
|
|
|
void Shui_Ji(struct Tetris *); //随机产生方块
|
|
|
|
|
void Full(struct Tetris *); // 判断方块是否满行
|
|
|
|
|
void tihuan(int x);
|
|
|
|
|
void tihuan(int n,int x,int y,int z);
|
|
|
|
|
void panduan(int x);
|
|
|
|
|
/*隐藏控制台的光标*/
|
|
|
|
|
void HideCursor()
|
|
|
|
@ -74,6 +71,9 @@ int main()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
HideCursor();
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("f1.txt","w");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
/*图案*/
|
|
|
|
|
color(11);
|
|
|
|
|
gotoxy(20,3);
|
|
|
|
@ -284,17 +284,17 @@ void Ji_Lu()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("f1.txt","w");
|
|
|
|
|
fscanf(fp,"%d%d%d",&jilu.first,&jilu.second,&jilu.third);
|
|
|
|
|
fp=fopen("f1.txt","r+");
|
|
|
|
|
fscanf(fp,"%d%d%d",&first,&second,&third);
|
|
|
|
|
color(12);
|
|
|
|
|
gotoxy(30,9);
|
|
|
|
|
printf("第一名: %d分",jilu.first);
|
|
|
|
|
printf("第一名: %d分",first);
|
|
|
|
|
color(10);
|
|
|
|
|
gotoxy(30,12);
|
|
|
|
|
printf("第二名: %d分",jilu.second);
|
|
|
|
|
printf("第二名: %d分",second);
|
|
|
|
|
color(11);
|
|
|
|
|
gotoxy(30,15);
|
|
|
|
|
printf("第三名: %d分",jilu.third);
|
|
|
|
|
printf("第三名: %d分",third);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
getch(); //按任意键返回主界面
|
|
|
|
|
system("cls");
|
|
|
|
@ -302,17 +302,21 @@ void Ji_Lu()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*判断*/
|
|
|
|
|
void panduan(int x)
|
|
|
|
|
void panduan(int n)
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("f1.txt","w");
|
|
|
|
|
fscanf(fp,"%d%d%d",&jilu.first,&jilu.second,&jilu.third);
|
|
|
|
|
if(x>jilu.third)
|
|
|
|
|
fp=fopen("f1.txt","r");
|
|
|
|
|
fscanf(fp,"%d%d%d",&first,&second,&third);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
if(n>third)
|
|
|
|
|
{
|
|
|
|
|
printf("你破了一个记录哦!!!");
|
|
|
|
|
tihuan(x);
|
|
|
|
|
tihuan(n,first,second,third);
|
|
|
|
|
fp=fopen("f1.txt","w");
|
|
|
|
|
fprintf(fp,"%d %d %d",first,second,third);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*游戏界面 */
|
|
|
|
@ -762,22 +766,22 @@ for(i=tetris->y-2;i<tetris->y+2;i++)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tihuan(int x)
|
|
|
|
|
void tihuan(int n,int x,int y,int z)
|
|
|
|
|
{
|
|
|
|
|
if(x>jilu.first)
|
|
|
|
|
if(n>x)
|
|
|
|
|
{
|
|
|
|
|
jilu.third =jilu.second;
|
|
|
|
|
jilu.second =jilu.first;
|
|
|
|
|
jilu.first =x;
|
|
|
|
|
z=y;
|
|
|
|
|
y =x;
|
|
|
|
|
x=n;
|
|
|
|
|
}
|
|
|
|
|
else if(x<jilu.first&&x>jilu.second )
|
|
|
|
|
else if(n<x&&n>y )
|
|
|
|
|
{
|
|
|
|
|
jilu.third =jilu.second ;
|
|
|
|
|
jilu.second =x;
|
|
|
|
|
z =y;
|
|
|
|
|
y =n;
|
|
|
|
|
}
|
|
|
|
|
else if(x<jilu.second&&x>jilu.third )
|
|
|
|
|
else if(n<y&&n>z )
|
|
|
|
|
{
|
|
|
|
|
jilu.third =x;
|
|
|
|
|
z=n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*清除痕迹*/
|
|
|
|
|