#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>
//引用请注明出处:http://hi.baidu.com/neptune_moon/item/56ac4b0fe783acc891571823
#define MAX__X 23
#define MAX__Y 50
#define MAX_FOOD 50
#define ESC 27
#define SPACE 32
typedef struct Node{
int x;
int y;
struct Node *next;
}Node,*LinkList;
typedef struct{
LinkList front;
LinkList rear;
int length;
}Queue;
Queue snake;
void gotoxy(int x,int y)//坐标定位
{
COORD loc;
loc.X = y;
loc.Y = x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), loc);
}
void help_info()//显示帮助信息
{
gotoxy(8,55);
puts("按ESC键退出,空格键暂停:");
gotoxy(10,55);
puts("上,下,左,右:w,s,a,d");
gotoxy(12,55);
puts("蛇越长,速度也会越快:");
gotoxy(14,55);
puts("如无法控制蛇,请关闭");
gotoxy(15,56);
puts("大写键盘锁定状态:");
}
void game_info()//显示游戏信息
{
gotoxy(3,60);
printf("当前蛇长度: %d",snake.length);
gotoxy(5,60);
printf(" ");
gotoxy(5,60);
printf("离胜利还差: %d",MAX_FOOD-snake.length);
}