- 写的是一个较为简陋的俄罗斯方块控制台界面游戏,没有用到图形库函数,界面全部是用printf打印显示的,所以看起来比较粗糙。
- 整体思路的话,是自己想的,可能比较笨拙,毕竟是新手,很多东西写的都很不完善或者说,见笑了。
- 可以直接建立控制台程序,编译运行。
- 若有错误或者不当,给些建议和指导,感谢。
#include <stdio.h>
#include <dos.h>
#include <time.h>
#include <windows.h>
#include <conio.h>
#include <stdlib.h>
//全局变量
int flag_down,left_flag,right_flag,rotate_flag;//是否能左移或者右移以及旋转标志
int max_score,current_score,level,free_line;//最高分数、当前分数,等级和消去的行数
//方块结构体
struct Rock_shape{
char box[2];
int num;
}
//方块的结构体数组
Rock_shape[19]={
/*
■ ■■■■
■
■
■
*/
{0x88,0x88,0},
{0xF0,0x00,1},
/*
■ ■■
■ ■ ■ ■■■
■■ ■■■ ■ ■
*/
{0x88,0xC0,2},
{0x2E,0x00,3},
{0xC4,0x40,4},
{0xE8,0x00,5},
/*
■ ■■■ ■■ ■
■ ■ ■ ■■■
■■ ■
*/
{0x44,0xC0,6},
{0xE2,0x00,7},
{0xC8,0x80,8},
{0x8E,0x00,9},
/*
■
■■ ■■
■ ■■
*/
{0x8C,0x40,10},
{0x6C,0x00,11},
/*
■
■■ ■■
■ ■■
*/
{0x4C,0x80,12},
{0xC6,0x00,13},
/*
■ ■
■ ■ ■ ■ ■ ■ ■ ■
■■■ ■ ■ ■
*/
{0x4E,0x00,14},
{0x4C,0x40,15},
{0xE4,0x00,16},
{0x8C,0x80,17},
/*
■■
■■
*/
{0xCC,0x00,18}
};
//数组颜色标志结构体
struct Rock_color{
int flag;
int t;
};
static Rock_color result_down[21][10]={{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},
{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}};
//初始化打印起始坐标的每种方块的相对位置偏移量
struct save_i_j
{
signed int x;
signed int y;
};
save_i_j arry_i_j[19][4]={ {{0,0},{-1,0},{-2,0},{-3,0}},
{{0,0},{0,1},{0,2},{0,3}},
{{0,0},{-1,0},{-2,0},{-2,1}},
{{0,2},{-1,0},{-1,1},{-1,2}},
{{0,0},{0,1},{-1,1},{-2,1}},
{{0,0},{0,1},{0,2},{-1,0}},
{{0,1},{-1,1},{-2,1},{-2,0}},
{{0,0},{0,1},{0,2},{-1,2}},
{{0,0},{0,1},{-1,0},{-2,0}},
{{0,0},{-1,0},{-1,1},{-1,2}},
{{0,0},{-1,0},{-1,1},{-2,1}},
{{0,1},{0,2},{-1,0},{-1,1}},
{{0,1},{-1,0},{-1,1},{-2,0}},
{{0,0},{0,1},{-1,1},{-1,2}},
{{0,1},{-1,0},{-1,1},{-1,2}},
{{0,1},{-1,0},{-1,1},{-2,1}},
{{0,0},{0,1},{0,2},{-1,1}},
{{0,0},{-1,0},{-2,0},{-1,1}},
{{0,0},{0,1},{-1,0},{-1,1}}};
//设置光标的位置
void gotoxy(int posi_x,int posi_y)
{
COORD c;
c.X=posi_x-1;
c.Y=posi_y-1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);
}
//改变打印在控制台的字体颜色,包括方块的颜色
int rand_color(int t)
{
int color_num;
//color_num=rand()%6;
t=t+1;
switch(t)
{
case 1:
case 2:
color_num=5;
break;
case 3:
case 4:
case 5:
case 6:
color_num=4;
break;
case 7:
case 8:
case 9:
case 10:
color_num=3;
break;
case 11:
case 12:
color_num=2;
break;
case 13:
case 14:
color_num=1;
break;
case 15:
case 16:
case 17:
case 18:
color_num=0;
break;
case 19:
color_num=5;
break;
}
switch(color_num)
{
case 0:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_INTENSITY);//红色
break;
case 1:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN|FOREGROUND_INTENSITY);//绿色
break;
case 2:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE|FOREGROUND_INTENSITY);//蓝色
break;
case 3:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_INTENSITY);//紫色
break;
case 4:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY);//黄色
break;
case 5:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY);//青色
break;
default:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY);//白色
break;
}
return color_num;
}
//初始化界面
void Rec_draw(int max_score,int current_score,int level,int free_line)
{
int i,j;
//system("cls");// 清屏幕;
for (i=0;i<22;i++)
{
for (j=0;j<45;j++) //让光标走 col 格。
{
if(((0==i)||(21==i))&&((j>=2)&&(j<=23)))
printf("■");//打印上下边界
else
{
if((2==j)||(22==j))
printf("■");//打印中间两条垂直边界
if((40==j)&&(i!=21)&&(i!=15)&&(i!=11)&&(i!=7)&&(i!=0))
printf("■");
else
{
if((7==i)&&(j>21)&&(j<32))
printf("■");
else if((11==i)&&(j>21)&&(j<32))
printf("■");
else if((15==i)&&(j>21)&&(j<32))
printf("■");
else//游戏信息
{
printf(" ");
}
}
}
}
printf("\n"); //让光标走 row 行;
}
gotoxy(28,2);
rand_color(13);
printf("下一个方块");
rand_color(0);
gotoxy(28,9);
printf("最高分数:%d",max_score);
gotoxy(28,11);
printf("目前得分:%d",current_score);
rand_color(3);
gotoxy(28,13);
printf("速度等级:%d",level);
gotoxy(28,15);
printf("消去行数:%d",free_line);
rand_color(13);
gotoxy(28,17);
printf("ESC键:暂停/退出");
gotoxy(28,19);
printf("数字1键:重新开始");
gotoxy(28,21);
printf("ENTER键:继续游戏");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);//把打印颜色重置为白色
}
//消除移动残留
void free_rock_one_line(int go_x,int go_y,int t)
{
int i,j;
gotoxy(go_x,go_y);
int flag=0;
for(i=0;i<2;i++)
{
for(j=0;j<=7;j++)
{
if(0==Rock_shape[t].box[i])
{
break;
}
if((4==j)&&(0==i))
{
gotoxy(go_x-=(2*flag),go_y+=1);
flag=0;
}
if(((0==j)||(4==j))&&(1==i))
{
gotoxy(go_x-=(2*flag),go_y+=1);
flag=0;
}
if((Rock_shape[t].box[i])&(0x80>>j))
{
printf(" ");//打印方块
}
if(!((Rock_shape[t].box[i])&(0x80>>j)))
{
gotoxy(go_x+=2,go_y);
flag++;
}
}
}
}
//隐藏光标
void hide_cursor()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);//获取控制台光标信息
CursorInfo.bVisible = 0; //隐藏控制台光标
SetConsoleCursorInfo(handle, &CursorInfo);//设置控制台光标状态
}
//根据给定坐标和方块类型初始化方块
void init_arry(int i,int j,int t)
{
result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y].flag=1;
result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y].t=t;
result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y].flag=1;
result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y].t=t;
result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y].flag=1;
result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y].t=t;
result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y].flag=1;
result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y].t=t;
}
int rotate_box(int t)//上键旋转方块
{
int t1;
int flag=0;
switch(t)
{
case 0:
t1=1;
break;
case 1:
t1=0;
break;
case 2:
case 3:
case 4:
t1=t+1;
break;
case 5:
t1=2;
break;
case 6:
case 7:
case 8:
t1=t+1;
break;
case 9:
t1=6;
break;
case 10:
t1=11;
break;
case 11:
t1=10;
break;
case 12:
t1=13;
break;
case 13:
t1=12;
break;
case 14:
case 15:
case 16:
t1=t+1;
break;
case 17:
t1=14;
break;
case 18:
t1=18;
break;
}
return t1;
}
int first_box(int t)
{
int high;
switch(t)
{
case 0:
high=19;
break;
case 1:
high=22;
break;
case 2:
case 4:
case 6:
case 8:
case 10:
case 12:
case 15:
case 17:
high=20;
break;
case 3:
case 5:
case 7:
case 9:
case 11:
case 13:
case 14:
case 16:
case 18:
high=21;
break;
default:
break;
}
return high;
}
int move_righ_x(int t)
{
int righ_x;
switch(t)
{
case 0:
righ_x=0;
break;
case 1:
righ_x=6;
break;
case 2:
case 4:
case 6:
case 8:
case 10:
case 12:
case 15:
case 17:
case 18:
righ_x=2;
break;
case 3:
case 5:
case 7:
case 9:
case 11:
case 13:
case 14:
case 16:
righ_x=4;
break;
default:
break;
}
return righ_x;
}
//检测是否满行
int free_full_row( )
{
int full_row[20]={0};
int h1=0,h=0;//满行计数
int i,j;
int flag_full=0,flag_empty=0;
//int full_row_num;
//检测哪些行满
for(i=1;i<=20;i++) //20列
{
for(j=0;j<=9;j++)//10列
{
if(0==result_down[i][j].flag)//有空格结束后续循环
break;
else if((1==result_down[i][j].flag)&&(9==j))//最后一列也没有空格,记下行号
full_row[h++]=i;
}
}
//full_row_num=strlen(full_row[h]);
//重设数组
for(i=1;i<=20;i++) //20列
{
for(j=0;j<=9;j++)//10列
{
if(i==full_row[h1])//检测到的满行
{
h1++;
flag_full++;
break;
}
else//没有检测到满行,则累加
{
if(0==flag_full)
break;
result_down[i-flag_full][j].flag=result_down[i][j].flag;//把当前这行向下移动监测到的满行数目
result_down[i-flag_full][j].t=result_down[i][j].t;
result_down[i][j].flag=0;
result_down[i][j].t=0;
//flag_empty++;
}
}
}
return h;
}
int dif_rock_arry1(int rock_x,int rock_y,int t)
{
int righ_x;
int flag_down;
int i,j;
int arry_x,arry_y;
int high;
int k;
arry_x=22-rock_y;
arry_y=(rock_x/2)-2;
i=arry_x;
j=arry_y;
//可以继续下落
if((0==result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y].flag)&&(0==result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y].flag)&&(0==result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y].flag)&&(0==result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y].flag)&&(rock_y!=18))
{
flag_down=1;
}
//无法向左移动
if((1==result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y-1].flag)||(1==result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y-1].flag)||(1==result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y-1].flag)||(1==result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y-1].flag))
{
left_flag=0;
}
//无法向右移动
if((1==result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y+1].flag)||(1==result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y+1].flag)||(1==result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y+1].flag)||(1==result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y+1].flag))
{
right_flag=0;
}
//下落有阻挡
if((1==result_down[i+arry_i_j[t][0].x-1][j+arry_i_j[t][0].y].flag)||(1==result_down[i+arry_i_j[t][1].x-1][j+arry_i_j[t][1].y].flag)||(1==result_down[i+arry_i_j[t][2].x-1][j+arry_i_j[t][2].y].flag)||(1==result_down[i+arry_i_j[t][3].x-1][j+arry_i_j[t][3].y].flag))
{
init_arry(i,j,t);
flag_down=0;//无法继续下落
}
high=first_box(t)-1;
//落到地板无阻挡(测试通过)
if((high==rock_y)&&(0==result_down[i+arry_i_j[t][0].x][j+arry_i_j[t][0].y].flag)&&(0==result_down[i+arry_i_j[t][1].x][j+arry_i_j[t][1].y].flag)&&(0==result_down[i+arry_i_j[t][2].x][j+arry_i_j[t][2].y].flag)&&(0==result_down[i+arry_i_j[t][3].x][j+arry_i_j[t][3].y].flag))
{
init_arry(i,j,t);
flag_down=0;//无法继续下落
}
righ_x=move_righ_x(t);//重设左右可移动的值
//旋转的下个方块
k=t;
t=rotate_box(t);//旋转
//是否可以旋转
if((1==result_down[i+arry_i_j[t][0].x-1][j+arry_i_j[t][0].y].flag)||(1==result_down[i+arry_i_j[t][1].x-1][j+arry_i_j[t][1].y].flag)||(1==result_down[i+arry_i_j[t][2].x-1][j+arry_i_j[t][2].y].flag)||(1==result_down[i+arry_i_j[t][3].x-1][j+arry_i_j[t][3].y].flag)&&(rock_x+righ_x>=23))
rotate_flag=0;
t=k;//复原方块类型
return flag_down;
}
//数组重置清零
void clear_arry()
{
int i,j;
for(i=1;i<=20;i++) //20列
{
for(j=0;j<=9;j++)//10列
{
result_down[i][j].flag=0;//占有标志置零
result_down[i][j].t=0;//方块类型置零
}
}
return ;
}
//产生随机的方块
void Create_next_shape(int go_x,int go_y,int t,int time)
{
int i,j;
gotoxy(go_x,go_y);
int flag=0;
for(i=0;i<2;i++)
{
for(j=0;j<=7;j++)
{
if(0==Rock_shape[t].box[i])
{
break;
}
if((4==j)&&(0==i))
{
gotoxy(go_x-=(2*flag),go_y+=1);
flag=0;
}
if(((0==j)||(4==j))&&(1==i))
{
gotoxy(go_x-=(2*flag),go_y+=1);
flag=0;
}
if((Rock_shape[t].box[i])&(0x80>>j))
{
rand_color(t);//改变打印方块的颜色
printf("■");//打印方块
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);//把打印颜色重置为白色
}
if(!((Rock_shape[t].box[i])&(0x80>>j)))
{
gotoxy(go_x+=2,go_y);
flag++;
}
}
}
Sleep(time);
}
void draw_board(int t)
{
int i,j;
int b_x=5,b_y=21;
gotoxy(b_x,b_y);
for(i=0;i<21;i++)
{
for(j=0;j<10;j++)
{
if(1==result_down[i][j].flag)
{
rand_color(result_down[i][j].t);//改变打印方块的颜色
printf("■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);//把打印颜色重置为白色
}
else
printf(" ");
}
gotoxy(b_x,b_y--);
}
}
int main()
{
max_score=0;//最高分数
//重新开始游戏的goto语句
_restart:
int time;//控制下落速度变量
static int key;//按键键值
int t1=0,t2;
t2=rand()%19;//随机产生初始方块类型的变量
//t2=2;
int flag=0;
int rock_x,rock_y;
int high=22;
int righ_x;
current_score=0;//目前得分
level=1;//速度等级
free_line=0;//消去的行数
int free_line_num=0;
//1)初始化界面
//2)初始化等级,分数,产生的随机方块和下一个随机方块
//3)开始游戏,可控制左、右、快速下移和行满自动消除
//处理第一个方块
high=first_box(t2); //预设可下降距离
righ_x=move_righ_x(t2);//预设左右可移动距离
while(1)
{
if(1==level)
time=800;//通过延时来控制下降速度
time=800-50*level;
int fall_distance=0;//下落距离
int step=1;
rock_x=11;
Rec_draw(max_score,current_score,level,free_line);//打印界面
draw_board(t2);//打印堆叠方块
//初始化下落、左、右、旋转标志
if(0==flag)
{
//生成下个方块
t1=rand()%19;
//t1=2;
rand_color(t1);//改变颜色
Create_next_shape(29,4,t1,time);
//if(1==rotate_flag)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);//把打印颜色重置为白色
righ_x=move_righ_x(t1);//重设左右可移动的值
flag=1;
}
//取得右移变化值
flag_down=1;
left_flag=1;
right_flag=1;
rotate_flag=1;
if(1==flag)
{
//产生一个自动下降的方块
for(rock_y=2;rock_y<=high;rock_y+=step)
{
fall_distance++;
//复位移动
rotate_flag=1;
left_flag=1;
right_flag=1;
//堆积结果收集,在显示前判断是否可以左或者右或者继续下落,若条件不满足,退出循环。
flag_down=dif_rock_arry1(rock_x,rock_y,t2/*,left_flag,right_flag,rotate_flag*/);
if(rotate_flag)
{
high=first_box(t2);//重设高度
righ_x=move_righ_x(t2);//重设左右可移动的值
}
hide_cursor();//隐藏光标
Create_next_shape(rock_x,rock_y,t2,time);//显示下落方块
hide_cursor();
free_rock_one_line(rock_x,rock_y,t2);//清除前一次显示的下落方块
hide_cursor();
if(!flag_down)
{
if(1==fall_distance)//堆积到最上边界
{
while(1)
{
gotoxy(5,10);
printf(" ");
gotoxy(11,10);
printf("游戏结束!");
gotoxy(5,11);
printf(" ");
gotoxy(8,11);
printf("历史最高得分:%d\n",max_score);
gotoxy(5,12);
printf(" ");
gotoxy(9,12);
printf("你的得分是:%d\n",current_score);
key=getch();
if(49==key)//数字键1,重新开始
{
clear_arry();
system("cls");
goto _restart;;
}
else if(27==key)//esc键,退出游戏
{
system("cls");
goto _End;
}
}
}
break;
}
//控制处理:左右移动,旋转,快速下落
while(kbhit())//检测到按键输入
{
key=getch();
//printf("%d",key);
switch(key)
{
case 75:
if(left_flag)
rock_x-=2;// 向左移动
break;
case 77:
if(right_flag)
rock_x+=2;// 向右移动
break;
case 80:
//快速下落
time/=2;
break;
case 72:
if(rotate_flag)
t2=rotate_box(t2);//旋转
break;
case 27://ESC键
while(1)
{
Create_next_shape(rock_x,rock_y,t2,time);//显示下落方块
hide_cursor();
key=getch();
//printf("%d",key);
if(13==key)//回车键继续
{
gotoxy(5,10);
printf("继续游戏!");
Sleep(500);
gotoxy(5,10);
printf(" ");
free_rock_one_line(rock_x,rock_y,t2);//清除前一次显示的下落方块
hide_cursor();
break;
}
else if(49==key)//数字1键
{
free_rock_one_line(rock_x,rock_y,t2);//清除前一次显示的下落方块
hide_cursor();
gotoxy(5,10);
printf("重新开始游戏!");
Sleep(1000);
gotoxy(5,10);
printf(" ");
system("cls");
clear_arry();
goto _restart;
}
}
break;
}
key=0;
}
if(!kbhit())//没有检测到按键输入
{
key=0;
}
if(rock_x<=5)//移动到最左边
{
rock_x=5;
}
if(rock_x+righ_x>=23)//移动到最右边
{
rock_x=23-righ_x;
}
}
//检测数组里面的满行
free_line_num=free_full_row();//取得满行数
free_line+=free_line_num;//累加满行数
//累计分数
current_score=free_line*20;
if(current_score>max_score)
max_score=current_score;
flag=0;
t2=t1;
}
if(free_line==1*level)//
{
level++;
}
system("cls");
}
_End:
return 0;
}