Sign in to follow this  

AStar question

Recommended Posts

lucky6969b    1330
I found some phrases in common AI literatures for astar difficult to understand. If we have a node in the open list (the node the Agent standing on), why does the program pop the node from the list right away in the subsequent statements from the start? If we do so, the open list immediately gets emptied. And should stop in the case? 2 books I am reading,AI programming Wisdom 1 and Game programming Gems 1, both say this thing... Do I misunderstand them? And a second question about it in AIW1 [CODE] void CAStar::LinkChild(_asNode* node, _asNode *temp) { int x = temp->x; int y = temp->y; int g = node->g + udFunc(udCost, node, temp, 0, m_pCBData); int num = Coord2Num(x,y); ... _asNode *check = NULL; if (check = CheckList(m_pOpen, num)) { node->children[node->numchildren++] = check; if (g < check->g) { ... [/CODE] I don't understand what the differences are between g and check->g? Anyone remember and share insights? Thanks Jack [Edited by - lucky6969b on August 19, 2008 4:27:37 AM]

Share this post

Link to post
Share on other sites
markgame66    132

The open list will indeed be emptied straight away, and the start node will go onto the closed list. However, you'll then start looping round adding (if possible) elements to the open list as you find the best scoring node in the sourrounding selection.


Very useful


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this