From c43047202f346ff63de667118c847ac06f85b162 Mon Sep 17 00:00:00 2001 From: 18408000525 <18408000525@edu.hut.stu.com> Date: Fri, 11 Jan 2019 11:55:24 +0800 Subject: [PATCH] first commit --- 俄罗斯方块极简版.c | 265 +++++++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 俄罗斯方块极简版.c diff --git a/俄罗斯方块极简版.c b/俄罗斯方块极简版.c new file mode 100644 index 0000000..7b9cb25 --- /dev/null +++ b/俄罗斯方块极简版.c @@ -0,0 +1,265 @@ +#include +#include +#include +#include +#include +#include +#define N 20 +#define M 16 +int cur_x,cur_y; +int score,mark,next,map[N][M],Gamespeed=400; +int shape[28][6]= +{ + {0,-1,0,-2,1,0}, {0,1,1,0,2,0}, {-1,0,0,1,0,2}, {0,-1,-1,0,-2,0}, + {0,-1,0,1,-1,0}, {0,1,1,0,-1,0}, {1,0,0,-1,0,1}, {1,0,-1,0,0,-1}, + {-1,1,0,1,1,0}, {0,-1,1,0,1,1}, {-1,0,0,-1,1,-1}, {-1,-1,-1,0,0,1}, + {-1,0,0,1,1,1}, {0,1,1,-1,1,0}, {-1,0,0,1,1,1}, {0,1,1,-1,1,0}, + {-1,0,0,-1,0,-2}, {-1,0,-2,0,0,1}, {0,1,0,2,1,0}, {0,-1,1,0,2,0}, + {0,1,1,0,1,1}, {0,-1,1,0,1,-1}, {-1,0,0,-1,-1,-1}, {-1,0,-1,1,0,1}, + {0,1,0,2,0,3}, {1,0,2,0,3,0}, {0,-1,0,-2,0,-3}, {-1,0,-2,0,-3,0} +}; +void Init(int now); +void PrintPrompting(); +void YourScore(); +void GotoxyWithFullwidth(short x, short y);//ȫ +void Gameover(); +void ShowMap(int now); +void GotoxyWithFullwidth(short x, short y)//ȫǶλ +{ + static COORD cd;//궨 + cd.X = x; + cd.Y = y; + HANDLE A_GConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleCursorPosition(A_GConsoleOutput, cd); +} +void PrintPrompting()//ʾʾϢ +{ + HANDLE A_GConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTextAttribute(A_GConsoleOutput, 0xF); + GotoxyWithFullwidth(50, 5); + printf("ƶ "); + GotoxyWithFullwidth(50, 6); + printf("ƶ "); + GotoxyWithFullwidth(50, 7); + printf("ƶ "); + GotoxyWithFullwidth(50, 8); + printf("˳ʱת "); + GotoxyWithFullwidth(50, 9); + printf("ոͣ鵹"); + GotoxyWithFullwidth(50, 14); + printf("|ӭ ˹ ") ; + GotoxyWithFullwidth(50,15); + printf("|ԱƷ߾֮"); + GotoxyWithFullwidth(50, 16); + printf("|ɰӣ") ; + GotoxyWithFullwidth(50, 17); + printf("|˼ҲŲǴӱȣ"); + GotoxyWithFullwidth(50, 18); + printf("|Ϸ~~~~~ιιһˮҲ̫˰ȣ"); + GotoxyWithFullwidth(75, 28); + printf("By: һֻڽûֵС˼"); +} +void Gameover()//жϷǷ +{ + int i,j,flag=0; + for(j=1;j1;p--) + { + for( q=1;q