上最流行的C语言编译器之一。 TURBO C 2.0版编程环境的一个主要缺点是不支持鼠标操作,也不能同时编辑多个文件。
五、总结和体会
俄罗斯方块曾在童年时代给了我无尽的快乐,而现在我又亲自用自己的知识制作了一个俄罗斯方块的软件,这使我很有成就感。编写软件使我提高了很多很多,相比以前我更加耐心、细心了,在思维的方面也更加周全了。 同时,我也发现了自己的缺点和不足之处,在遇到问题的时候我 缺乏一个编程人员应有的沉着和冷静,不能够立即进行思考。相信更多的磨练会让我的意志更加坚定,思维更加活跃和全面。 在此,我要感谢我的团队的其他成员,正是有了他们,我们的团队才能够圆满的完成任务。
16
源代码: #include
17
{ int rgrade; int rlnum; int rpoint; }rl[10]; /*记录游戏得分前十名的成绩*/ struct blocktype { int bktp[4][4]; int color; }bt[19]; /*记录所有方块的形状(共19种)及颜色*/ struct p_ztemp { int x,y,bp[4][4]; int color; }tempbt; /*在预览区与游戏窗口(主显屏)之间做缓冲存储*/ int zxp[23][10],zxpcolor[23][10]; /*记录游戏窗口信息,共20行,10列,前3行为玩家多提 供些操作时间*/ int delline[4]={0}; /*记录需要删除的行*/ struct blocktype pre; /*记录预览区方块信息*/ unsigned int grade=0,lnum=0,point=0; /*记录游戏成绩*/ void initzxp(void); int menu(void); void initmenu(void); void choosecard(int,int,int,char*); void newgame(void); void lastgame(void); void ran_list(void); void initgame(void); void initbt(void); int randompre(void); void pretozxp(int); void pretotemp(int); void temptozxp(void); void refresh(void); void refzxp(void); void refpre(void); void hfk(int,int,int,int,int); void refgmglp(void); int judgedown(int); int judgedel(void); void delfun(void); void ash_down(void); void amark(int *); int judgegm(void);
18
int gamedead(void); void saveran(void); void insertrldata(void); void tofile(void); void replay(int *); void savelast(int,int,int); void initdcard(void); void dchoosecard(int,int,int,char*); void clrzxpbt(void); void bktps_down(void); void initbt0(void); void initbt1(int); void initbt2(int); void initbt3(int); void initbt4(int); void initbt5(int); void initbt6(int); void initbt7(int); int gamehandle(int*,int*); int judgeleft(int); void bktps_left(void); int judgeright(int); void bktps_right(void); int judgeturn(int); void bktps_turn(int*,int); void turntotemp(int); int getlastdata(int *,int *); void nolastgame(char *); void initranlist(void); int getrlistdata(void); void outrldata(void); int main() { int wich; int gdirve=DETECT,gmode; initgraph(&gdirve,&gmode,\ initzxp(); while(1) { wich=menu(); switch(wich) { case 0: newgame(); /*新游戏*/
19
cleardevice(); break; case 1: lastgame(); /*上次游戏*/ cleardevice(); break; case 2: ran_list(); /*排行榜*/ cleardevice(); break; case 3: closegraph(); return 0; /*退出游戏*/ default: ; } } } void initzxp(void) { int i,j; for(i=0;i<24;i++) for(j=0;j<10;j++) { zxp[i][j]=0; zxpcolor[i][j]=BKCOLOR; } return; } int menu(void) { char ch,*mar[4]={\ New game \ Last game \ /*初始化选项卡里面的内容*/ int wich=0; /*刚进入菜单时,指向 \新游戏(New game)\ initmenu(); choosecard(0,SIGNCOLOR,CCOLOR2,mar[0]); while(1) { ch=getche(); switch(ch) { case 'W': case 'w': case 72: choosecard(wich,CCOLOR1,CCOLOR2,mar[wich]);
20