其实一点也不好玩,就是看着小蛇吃苹果
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <math.h>
//#include <unistd.h>
#include <conio.h>
#include <string.h>
#include <time.h>
void food();
void show();
void move();
void turn();
void check();
void ini();
void calculate();
int movable[4] = { 0, 1, 1, 0 };
int distance[4] = { 9999, 9999, 9999, 9999 };
int dy[4] = { 0, 1, 0, -1 };
int dx[4] = { -1, 0, 1, 0 };
int sum = 5;
int over = 0;
int speed;
int foodx, foody;
char map[17][17];
struct snake {
int x, y;
int dir;
} A[100];
void ini() {
speed = 500;
over = 0;
sum = 5;
movable[0] = 0;
movable[1] = 1;
movable[2] = 1;
movable[3] = 0;
distance[0] = 9999;
distance[1] = 9999;
distance[2] = 9999;
distance[3] = 9999;
int i, j;
for (i = 0; i < 100; i++) {
A[i].dir = 0;
A[i].x = 0;
A[i].y = 0;
}
A[0].x = 1;
A[0].y = 1;
A[1].x = 1;
A[1].y = 2;
A[2].x = 1;
A[2].y = 3;
A[3].x = 1;
A[3].y = 4;
A[4].x = 1;
A[4].y = 5;
A[4].dir = 1;
srand(time(0));
for (i = 0; i < 17; i++