04.03.2015
With Easter weekend I want to buckle down and look at what I
am doing wrong. So I re wrote my pseudo code.
a-star psudo code
map info
startPos
destinPos
currentPos
calcVal – multidim matrix with all the calculated values
in it
openlist – matrix will contain the row vecotors as a list
closedlist
put startPos into the openList and set f value of
startPos to zero
do loop while openlist is not empty and while looping is
true
-get
the vector with the lowest f from the openlist and set it to currentPos
-get
the neighbours of currentPos and for each neighbour and while looping is true
Set
m=movementcost to neighbour
Set
nx,ny as the neighbour loc
-check
if neighbour is in the grid
-no
don’t don’t do the other checks
-yes, check if neighbour is
destPos –yes, set parant into of destPos and set
looping to false
check if neighbour is walkable
-no,
nothing
-yes,
check if its in the closed list
-yes,
nothing
-no,
check if its in the openlist
-yes,
check if m+g of current<g of n
-no,
nothing
-yes,
change parent of n to current
-no,
calculate vals and add to openlist
-del
currentnode from openlist and add current node to closed list.
End while loop
Which are the functions that need to be written.
Check if node is in the grid
Check if node is walkable
Check if node is in the list
No comments:
Post a Comment