|
贪吃蛇源程序(1)
本程序为贪吃蛇游戏,想必大家都玩过这个游戏,程序源代码用TC2.0编译通过,需要图形驱动文件的支持,在TC2.0的集成环境中有. 本程序利用数据结构中的链表,来将蛇身连接,同时当蛇吃到一定数目的东西时会自动升级,及移动速度会加快,程序会时刻将一些信息显示在屏幕上,包括所得分数,要吃多少东西才能升级,并且游戏者可以自己手动选择游戏级别,级别越高,蛇的移动速度越快. 另外,此游戏可能与CPU的速度有关系. 源代码如下: ********************************************************************************** /*******************************COMMENTS**********************************/ /* snake_game.c */ /* it is a game for entermainment. */ /* in the begin,there is only a snake head,and it will have to eat food */ /* to become stronger,and it eat a piece of food each time,it will */ /* lengthen it's body,with the number of food the snake eats going up,it */ /* will become long more and more,and the score will goes up also. */ /* there is always useful information during the game process. */ /* if the path by which the snake goes to eat food is the shortest,the */ /* score will add up a double. */ /* */ /* enjoy yourself,and any problem,contact <blldw@etang.com> */ /*************************************************************************/ /* all head file that will be used */ #include<stdio.h> #include<time.h> #include<graphiCS.h> #include<stdlib.h> #include<ctype.h> #include<string.h> /* useful MACRO */ #define FOOD_SIZE 8
|