int main()
{
vector<int> open;
vector<int> close;
map<int,GFN*>::iterator pos;
vector<int>::iterator it;
int n,gn,fn;
int n1,gn1,fn1;
int ci,cj;
int ni,nj;
GFN* pgf = NULL;
printmaze();
ci = Bi;
cj = Bj;
n = ci*MAZE_COL + cj;
gn = 0;
fn = abs(Ei-ci)+abs(Ej-cj);
pgf=new GFN;
pgf->gn = 0;
pgf->fn = fn;
pgf->flag = 1;
gmap[n] = pgf;
open.push_back(n);
while(!open.empty()){
n = open.front(); //pop front from open
open.erase(open.begin());
ci = n/MAZE_COL; //the corren sit
cj = n%MAZE_COL;
pos = gmap.find(n); //find the sit
gn = pos->second->gn;
fn = pos->second->fn;
pos->second->flag = 2;
close.push_back(n); //push n into close
if(ci==Ei && cj==Ej)
{
cout<<"找到最短路径,长度为:"<<gn<<endl;
// getway(Ei,Ej,gn-1);
// printway();
return 1;
}
gn1 = gn+1;
for(int d=0; d<4; ++d){
ni = ci;
nj = cj;