@@ -18,7 +18,7 @@ def minkey(self):
1818 return self .elements [0 ][0 ]
1919 else :
2020 return float ('inf' )
21-
21+
2222 def empty (self ):
2323 return len (self .elements ) == 0
2424
@@ -48,10 +48,10 @@ def remove_element(self, item):
4848 (pro , x ) = heapq .heappop (self .elements )
4949 for (prito , yyy ) in temp :
5050 heapq .heappush (self .elements , (prito , yyy ))
51-
51+
5252 def top_show (self ):
5353 return self .elements [0 ][1 ]
54-
54+
5555 def get (self ):
5656 (priority , item ) = heapq .heappop (self .elements )
5757 self .set .remove (item )
@@ -65,7 +65,7 @@ def consistent_hueristic(P, goal):
6565
6666def hueristic_2 (P , goal ):
6767 # integer division by time variable
68- return consistent_hueristic (P , goal ) // t
68+ return consistent_hueristic (P , goal ) // t
6969
7070def hueristic_1 (P , goal ):
7171 # manhattan distance
@@ -74,13 +74,13 @@ def hueristic_1(P, goal):
7474def key (start , i , goal , g_function ):
7575 ans = g_function [start ] + W1 * hueristics [i ](start , goal )
7676 return ans
77-
77+
7878def do_something (back_pointer , goal , start ):
7979 grid = np .chararray ((n , n ))
8080 for i in range (n ):
8181 for j in range (n ):
8282 grid [i ][j ] = '*'
83-
83+
8484 for i in range (n ):
8585 for j in range (n ):
8686 if (j , (n - 1 )- i ) in blocks :
@@ -94,7 +94,7 @@ def do_something(back_pointer, goal, start):
9494 grid [(n - 1 )- y_c ][x_c ] = "-"
9595 x = back_pointer [x ]
9696 grid [(n - 1 )][0 ] = "-"
97-
97+
9898
9999 for i in xrange (n ):
100100 for j in range (n ):
@@ -112,7 +112,7 @@ def do_something(back_pointer, goal, start):
112112 print ("PATH TAKEN BY THE ALGORITHM IS:-" )
113113 x = back_pointer [goal ]
114114 while x != start :
115- print (x , end = ' ' )
115+ print (x , end = ' ' )
116116 x = back_pointer [x ]
117117 print (x )
118118 quit ()
@@ -153,7 +153,7 @@ def expand_state(s, j, visited, g_function, close_list_anchor, close_list_inad,
153153 if key (neighbours , var , goal , g_function ) <= W2 * key (neighbours , 0 , goal , g_function ):
154154 # print("why not plssssssssss")
155155 open_list [j ].put (neighbours , key (neighbours , var , goal , g_function ))
156-
156+
157157
158158 # print
159159
@@ -212,7 +212,7 @@ def multi_a_star(start, goal, n_hueristic):
212212 for i in range (n_hueristic ):
213213 open_list .append (PriorityQueue ())
214214 open_list [i ].put (start , key (start , i , goal , g_function ))
215-
215+
216216 close_list_anchor = []
217217 close_list_inad = []
218218 while open_list [0 ].minkey () < float ('inf' ):
@@ -263,4 +263,7 @@ def multi_a_star(start, goal, n_hueristic):
263263 print ()
264264 print ("# is an obstacle" )
265265 print ("- is the path taken by algorithm" )
266- multi_a_star (start , goal , n_hueristic )
266+
267+
268+ if __name__ == "__main__" :
269+ multi_a_star (start , goal , n_hueristic )
0 commit comments