merged semi-final
This commit is contained in:
commit
230b63d87b
8
astar.py
8
astar.py
@ -42,12 +42,12 @@ def astar(obiekty, start, cel):
|
|||||||
continue
|
continue
|
||||||
elif 6 <= sasiad[0] <= 7 and 10 <= sasiad[1] <= 11:
|
elif 6 <= sasiad[0] <= 7 and 10 <= sasiad[1] <= 11:
|
||||||
continue
|
continue
|
||||||
tentative_g_score = gscore[current] + \
|
tentative_h_score = heurystyka(
|
||||||
heurystyka(obiekty, current, sasiad)
|
obiekty, sasiad, cel) + heurystyka(obiekty, current, sasiad)
|
||||||
|
|
||||||
if sasiad in close_set and tentative_g_score >= gscore.get(sasiad, 0):
|
if sasiad in [i[1] for i in oheap] and tentative_h_score < hscore.get(current, 0):
|
||||||
continue
|
continue
|
||||||
if sasiad not in close_set and sasiad not in [i[1] for i in oheap]:
|
elif sasiad not in close_set and sasiad not in [i[1] for i in oheap]:
|
||||||
came_from[sasiad] = current
|
came_from[sasiad] = current
|
||||||
hscore[sasiad] = tentative_h_score
|
hscore[sasiad] = tentative_h_score
|
||||||
fscore[sasiad] = tentative_h_score + gscore[current]
|
fscore[sasiad] = tentative_h_score + gscore[current]
|
||||||
|
@ -64,7 +64,6 @@ class Smieciarka(pygame.sprite.Sprite):
|
|||||||
self.w_gore()
|
self.w_gore()
|
||||||
elif koord[0] == self.x and koord[1] - 1 == self.y:
|
elif koord[0] == self.x and koord[1] - 1 == self.y:
|
||||||
self.w_dol()
|
self.w_dol()
|
||||||
print("skonczylem")
|
|
||||||
|
|
||||||
def w_lewo(self):
|
def w_lewo(self):
|
||||||
if self.x > 0:
|
if self.x > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user