#include <stdio.h>
#include <stdlib.h>
#define INITSIZE 100
#define INCREAMENT 10
#define M 8
#define N 8
typedef struct{
int x;
int y;
}PosType;
typedef struct{
int ord;
PosType seat;
int di;
}SElemType;
typedef struct SqStack{
SElemType * data;
SElemType * top;
int stacksize;
}SqStack;
void InitStack(SqStack * S){
S -> data = (SElemType *)malloc(INITSIZE * sizeof(SElemType));
if (!(S -> data)) exit(0);
S -> top = S -> data;
S -> stacksize = INITSIZE;
}
void Push(SqStack * S, SElemType e){
if(S -> top - S -> data >= S -> stacksize){
S -> data = (SElemType *)realloc(S -> data, (S -> stacksize + INCREAMENT) * sizeof(SElemType));
if (!(S -> data)) exit(0);
S -> top = S -> data + S -> stacksize;
S -> stacksize = S -> stacksize + INCREAMENT;
}
* (S -> top ++) = e;
}
void Pop(SqStack * S, SElemType * e){
if (S -> data == S -> top) exit(0);
* e = *(-- S -> top);
}
void GetTop(SqStack S, SElemType * e){
if (S.data == S.top) exit(0);
* e = * (S.top - 1);
}
bool Pass(int a[M + 2][N + 2], PosType pos){
int x = pos.x;
int y = pos.y;
if (a[x][y] == 0) //可通
return true;
else
return false;
}
bool Footprint(int a[M + 2][N + 2], PosType pos){
int x = pos.x;
int y =