first commit

master
unknown 6 years ago
parent 9309aa5fd0
commit a58d1cc502

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

Loading…
Cancel
Save