#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <time.h>
/*
*迷宫的高度
*/
#define Height 23
/*
*迷宫的宽度
*/
#define Width 39
#define Esc 5
#define Up 1
#define Down 2
#define Left 3
#define Right 4
#define Wall 1
#define Road 0
#define Start 2
#define End 3
int map[Height+2][Width+2];
/*
*随机生成迷宫
*/
void create(int x,int y)
{
int c[4][2]={0,1,1,0,0,-1,-1,0}; /*四个方向*/
int i,j,t;
/*
*将方向打乱
*/
for(i=0;i<4;i++)
{
j=rand()%4;
t=c[i][0];c[i][0]=c[j][0];c[j][0]=t;
t=c[i][1];c[i][1]=c[j][1];c[j][1]=t;
}
map[x][y]=Road;
for(i=0;i<4;i++)
if(map[x+2*c[i][0]][y+2*c[i][1]]==Wall)