C语言控制台版贪吃蛇 链表实现

时间:2016-05-09 13:07:30
【文件属性】:

文件名称:C语言控制台版贪吃蛇 链表实现

文件大小:4KB

文件格式:RAR

更新时间:2016-05-09 13:07:30

贪吃蛇、 控制台、 C语言

#include #include #include #include "snake.h" int main (void) { Psnake head; Psnake tail ; Dir direction = R; Coordinate food = {0,0}; int being_food = FALSE; int leng = 3; int score, diff, pause, level; score = 0; pause = 0; level = 0; IniHead (&head, &tail); SetConsoleTitle ("渣版贪吃蛇"); setCursorVisible (FALSE); diff = Menu(); if (!diff) { ShowBye (); return 0; } system ("cls"); IniSnake (&head, &tail, leng); IniCoord (&head, 5, 5); being_food = IniFood (&head, &food); draw_map (&head); draw_food (&food); do{ if (pause) { ShowPause (); pause = 0; system ("cls"); draw_map(&head); draw_food(&food); } if (!being_food) { being_food = IniFood (&head, &food); score += 50; draw_food(&food); } if (level <= 12) level = diff + (leng -3) / 10; gotoxy (68, 8); printf ("%d", score); gotoxy (69, 5); printf ("%d", level); Sleep (CALTIME(level)); HasKey (&direction, &pause); being_food = MoveSnake (&head, &tail, &direction, &food, &leng); }while (OVER != being_food); EmptySnake (&head); if ('y' == ShowOver (&score)) return main(); ShowBye(); return 0; }


【文件预览】:
snake.c
use.c
snake.h

网友评论