#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define origrow 1
#define origcol 1
#define destrow 8
#define destcol 8
typedef struct direction
{
int x;
int y;
}direction;
direction move[5]={{0,0},{0,1},{1,0},{0,-1},{-1,0}};
typedef struct{
int x;
int y;
int direction;
}elemtype;
typedef struct node
{ elemtype data;
struct node* next;
}stacknode,*stack;
int puzzle[10][10]=
{
1,1,1,1,1,1,1,1,1,1,
1,0,0,1,1,1,0,0,1,1,
1,1,0,0,1,0,1,1,0,1,
1,1,0,1,0,0,0,1,1,1,
1,1,0,0,1,1,0,0,1,1,
1,1,1,0,0,1,1,0,0,1,
1,0,0,0,1,1,0,0,1,1,
1,0,0,1,0,0,0,1,1,1,
1,0,0,0,0,1,0,0,0,1,
1,1,1,1,1,1,1,1,1,1
};
//初始化链栈,返回链栈的头指针
stack initial_list()
{
stack top=(stack)malloc(sizeof(stacknode));
top->next=NULL;
return top;
}
//入栈
int push(stack s,elemtype x)
{
stacknode* p=(stacknode*)malloc(sizeof(stacknode));
if(p)
{
p->data=x;
p->next=s->next;
s->next=p;
return 1;
}
else
return 0;