#define RIGHT 0
#define DOWN 1
#define LEFT 2
#define UP 3
typedef struct Position{
int x;
int y;
}Position;
Position NextPos(Position now, int dir){
Position next;
int x = now.x;
int y = now.y;
switch(dir){
case RIGHT: next.x = x; next.y = y+1; break;
case DOWN: next.x = x+1; next.y = y; break;
case LEFT: next.x = x; next.y = y-1; break;
case UP: next.x = x-1; next.y = y; break;
}
return next;
}
#include <stdlib.h>
#include <stdio.h>
#include "maze.h"
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
#define MAXSIZE 1000
typedef int Status;
typedef struct Ele{
Position pos;
int step;
int dir;
}Ele;
typedef struct{
int Stacksize;
Ele* top;
Ele* base;
}Stack;
Stack* InitStack(void){
Stack* s = (Stack*)malloc(sizeof(Stack));
s->base = (Ele*)malloc(STACK_INIT_SIZE*sizeof(Ele));
if(!s->base){
printf(