20210201
#include <stdlib.h>
#include <curses.h>
struct snake
{
int hang;
int lie;
struct snake *next;
};
struct snake food;
#define UP 1
#define DOWN -1
#define LEFT 2
#define RIGHT -2
struct snake *head=NULL;
struct snake *tail=NULL;
int key;
int fangxiang;
int makesnake(int j,int k)
{
struct snake *p;
p = head;
while(p != NULL)
{
if(p->hang == j && p->lie == k)
{
return 1;
}
p = p->next;
}
return 0;
}
int die()
{
struct snake *p;
p = head;
if(tail->hang<0 || tail->lie==0 || tail->hang==30 || tail->lie==30)
{
return 1;}
while(p->next!=NULL)
{
if(p->hang == tail->hang && p->lie == tail->lie)
{
return 1;
}
p = p->next;
}
return 0;
}
int