FIGURE 5 : A-STAR G SCORE
The H scores were calculated by estimating the Manhattan
distance to the target square, moving only horizontally and vertically and ignoring the wall that is in the way. The F
score for each square, again was simply calculated by adding
G and H together.
For continuing the search, the lowest F score square from all those on the open list was considered and following steps were performed.
4. Dropped it from the open list and added it to the closed list.
5. Checked all of the adjacent squares. Added squares to the open list if they were not on the open list already. Selected square was made the “parent” of the new squares.
6. If an adjacent square was already on the open list, it was checked to see if this path to that square is a better one. Finally both the F and G scores of that square were recalculated.
That square was dropped from open list and added to close list and steps 4,5 and 6 were repeated with adjacent squares.