|
Algorithm 1: A* shortest path Algorithm with Greedy heuristic |
-
Require:
maze, start and goal
-
Ensure:
-
1:
procedureA_Star() ▷ returns path
-
2:
Add to
-
3:
-
4:
-
5:
while do
-
6:
if then
-
7:
return
-
8:
end if
-
9:
Remove from
-
10:
Add to
-
11:
-
12:
-
13:
-
14:
for each in do
-
15:
if is in then
-
16:
continue
-
17:
end if
-
18:
▷d is distance between and , which is 1 in this case
-
19:
-
20:
distance from to
-
21:
-
22:
▷h is calculated using heuristic function, Euclidean distance in this case
-
23:
-
24:
if is in then
-
25:
if then
-
26:
continue
-
27:
end if
-
28:
end if
-
29:
-
30:
Add to
-
31:
end for
-
32:
end while
-
33:
-
34:
return ▷ If is
-
35:
end procedure
|