diff --git a/俄罗斯方块游戏.c b/俄罗斯方块游戏.c index 6938be9..d1743d2 100644 --- a/俄罗斯方块游戏.c +++ b/俄罗斯方块游戏.c @@ -7,6 +7,7 @@ #define FrameY 3 //ϷϽǵYΪ3 #define Frame_height 20 //Ϸڵĸ߶Ϊ20 #define Frame_width 18 //ϷڵĿΪ18 + /****ȫֱ****/ int i,j,Temp,Temp1,Temp2; //Temp,Temp1,Temp2ڼסתֵ int a[80][80]={0}; //ϷĻͼ2,1,0 ֱʾλΪϷ߿򡢷顢ͼʼΪͼ @@ -22,6 +23,12 @@ struct Tetris int score; //Ϸķ int level; //Ϸĵȼ } ; +struct jilu_info + { + int first; + int second; + int third; + }jilu={0,0,0}; HANDLE hOut; //̨ /********/ void HideCursor(); //ع @@ -31,13 +38,15 @@ void Game(); // void Play(); //ʼϷ void explation(); //˵ void rule(); //Ϸ +void Ji_Lu(); //Ϸ¼ void Make(struct Tetris *); // void Print(struct Tetris *); //ӡ void Clean(struct Tetris *); //ۼ int If_move(struct Tetris *); //жǷƶ10 void Shui_Ji(struct Tetris *); // void Full(struct Tetris *); // жϷǷ - +void tihuan(int x); +void panduan(int x); /*ؿ̨Ĺ*/ void HideCursor() { @@ -63,6 +72,7 @@ void gotoxy(int x,int y) /*ҳ */ int main() { + HideCursor(); /*ͼ*/ color(11); @@ -155,12 +165,14 @@ int main() gotoxy(25,17); printf("3.Ϸ"); gotoxy(45,17); - printf("4.˳"); + printf("4.Ϸ¼"); gotoxy(21,22); color(3); + printf("˳"); + gotoxy(21,24); printf("ѡ[1 2 3 4]:[ ]\b\b"); scanf("%d",&n); - + printf("\a\a\a\a"); switch(n) { case 1: @@ -175,7 +187,10 @@ int main() rule(); break; case 4: + Ji_Lu(); break; + default: + break; } return 0; } @@ -251,6 +266,55 @@ void rule() main(); } +/*¼*/ +void Ji_Lu() +{ + int i,j = 1; + system("cls"); + color(6); + gotoxy(30,3); + printf(" Ϸ ¼"); + for (i = 6; i <= 18; i++) + { + for (j = 12; j <= 70; j++) + { + gotoxy(j, i); + if (i == 6 || i == 18) printf("="); + else if (j == 12 || j == 69) printf("||"); + } + } + FILE *fp; + fp=fopen("f1.txt","w"); + fscanf(fp,"%d%d%d",&jilu.first,&jilu.second,&jilu.third); + color(12); + gotoxy(30,9); + printf("һ %d",jilu.first); + color(10); + gotoxy(30,12); + printf("ڶ %d",jilu.second); + color(11); + gotoxy(30,15); + printf(" %d",jilu.third); + fclose(fp); + getch(); // + system("cls"); + main(); +} + +/*ж*/ +void panduan(int x) +{ + FILE *fp; + fp=fopen("f1.txt","w"); + fscanf(fp,"%d%d%d",&jilu.first,&jilu.second,&jilu.third); + if(x>jilu.third) + { + printf("һ¼Ŷ!!!"); + tihuan(x); + } + fclose(fp); +} + /*Ϸ */ void Game() { @@ -657,7 +721,7 @@ void Play() for(i=tetris->y-2;iy+2;i++) { if(i==FrameY) - { + { panduan(tetris->score); system("cls"); gotoxy(29,7); printf("\n"); @@ -685,8 +749,7 @@ for(i=tetris->y-2;iy+2;i++) { system("cls"); memset(a,0,6400*sizeof(int)); - Game(); - Play(); + main(); } else exit(0); @@ -699,6 +762,24 @@ for(i=tetris->y-2;iy+2;i++) } } +void tihuan(int x) +{ + if(x>jilu.first) + { + jilu.third =jilu.second; + jilu.second =jilu.first; + jilu.first =x; + } + else if(xjilu.second ) + { + jilu.third =jilu.second ; + jilu.second =x; + } + else if(xjilu.third ) + { + jilu.third =x; + } +} /*ۼ*/ void Clean(struct Tetris *tetris) { @@ -716,6 +797,7 @@ void Clean(struct Tetris *tetris) gotoxy(i,j); printf(" "); // } + printf("\a"); } } }