#include
#include
#include
#include
#define MAX_STACK_SIZE (MAX_ROW+2)*(MAX_COL+2)
#define MAX_ROW 10
#define MAX_COL 10
#define EXIT_ROW 8
#define EXIT_COL 8
typedef struct
{
int row;
int col;
int dir;
} element;
element move[8] =
{
{-1, 0, 0},
{ 0, 1, 1},
{ 1, 0, 2},
{ 0,-1, 3}
};
void stack_full(int *top);
void stack_empty(int *top);
void push(int *top, element item);
element pop(int *top);
void find_path(void);
int top = -1;
int maze[MAX_ROW+2][MAX_COL+2] =
{
{0,0,0,0,0,0,0,0,0,0},
{0,1,0,1,1,0,1,1,1,0},
{0,1,1,1,0,1,0,1,0,0},
{0,1,0,1,1,1,0,1,1,0},
{0,0,1,1,0,0,1,1,0,0},
{0,1,1,0,1,0,1,0,1,0},
{0,0,1,1,1,1,1,0,1,0},
{0,1,1,0,1,0,1,1,1,0},
{0,1,0,1,1,1,0,0,1,0},
…(생략)
|