int findInOpen(Node *n, mset &open)
{
	for(mset::iterator p=open.begin(); p!=open.end() ; p++)
	{
		if((*p)->x==n->x && (*p)->y==n->y )
		{
			if((*p)->fm > n->fm)
			{
				(*p)->fm = n->fm;
				(*p)->gm = n->gm;	
			}
			return 1;
		}
		
	}
	return 0;
}
int findInClosed(Node *n, mset &open, mset &closed)
{
	for(mset::iterator p=closed.begin(); p!=closed.end() ; p++)
	{
		if((*p)->x==n->x && (*p)->y==n->y )
		{
			if((*p)->fm > n->fm)
			{
				closed.erase(p);
				open.insert(n);
			}
			return 1;
		}
		
	}
	return 0;
}
Beispiel #3
0
void show(mset const &s,std::ostream& os){
	copy(s.begin(),s.end(),oi{os,", "});
	os << '\n';
}