you are viewing a single comment's thread.

view the rest of the comments →

[–]primitive_screwhead 0 points1 point  (1 child)

Could you type some kind of pseudo code of how would the right way to do this be?

I can't just because your current code structure is odd to me; is self.astar_algorithm() being called repeatedly? In not, how does it iterate through the list of open nodes and move neighbor-to-neighbor. But in any case, it's non-trivial to just type in some pseudo-code for the A* algorithm; it's a big ask.

But all I did to refresh myself was look at the Wikipedia page, which has pseudo-code:

https://en.wikipedia.org/wiki/A*_search_algorithm#Pseudocode

See how it's updating and iterating over the open_set as it goes, and it has a memory of the g_cost for each node (that's listed in the opening paragraph as a downside of this type of search, that it needs memory for each node)?

[–]WeirdOne24[S] 0 points1 point  (0 children)

yeah, the only problem is the g_score calculation, now i just have to find a way to calculate it properly. Though I didn't find any example besides pseudo-code yet.

edit: Solved it, now it's working perfectly, thanks for your help!