A* Pseudocode
1Create a node containing the goal state node_goal
2Create a node containing the start state node_start
3Put node_start on the OPEN list
4while the OPEN list is not empty
5{
6Get the node off the OPEN list with the lowest f and call it node_current
7if node_current is the same state as node_goal:
7bFound the solution; break from the while loop
8Generate each state node_successor that can come after node_current
9for each node_successor of node_current
10{
11Set the cost of node_successor to be (cost of node_current + cost to get to node_successor)
12Find node_successor on the OPEN list
13if node_successor is on the OPEN list but the existing one is as good or better:
13bDiscard this successor and continue
14if node_successor is on the CLOSED list but the existing one is as good or better:
14bDiscard this successor and continue
15Remove occurrences of node_successor from OPEN and CLOSED
16Set the parent of node_successor to node_current
17Set h to be the estimated distance to node_goal (heuristic)
18Add node_successor to the OPEN list
19}
20Add node_current to the CLOSED list
21}