Dos界面C贪吃蛇设计报告.docxVIP

  • 3
  • 0
  • 约5.95千字
  • 约 11页
  • 2019-09-14 发布于广东
  • 举报
综合实验项目:贪吃蛇游戏 1、问题需求 控制游戏:按方向键T川能控制蛇的移动; 蛇在固定的范围内移动,不能碰触边界。不能撞到自身,否则,游戏结束。 固定范围内随机出现白子,蛇每吃一个白子长长一格,分数增加,每增加5分蛇 的移动速度自动增加。 2、程序流程图 3、详细设计设计说明:本程序运行代码如下: #include iostream #include ctime #include conio.h #include windows.h #include time.h using namespace std; int scor*0,t=300,f“;〃得分与时间间隔/ms (控制贪吃蛇的速度) double ss=O,tt=O;〃统计时间所用参数 class Node Node(): x(0)f y(0)f prior(O), next(O) {} int x; int y; Node *prior; Node *next; friend class Snake; }; class Snake { public: Snake(); ~Snake(); void output(); void move(); void change.point(char); private: Node *head; Node *tail; enum p{ UP, RIGHT, DOWN, LEFT }

文档评论(0)

1亿VIP精品文档

相关文档