diff --git a/astar.py b/astar.py index 111876c..0978df4 100644 --- a/astar.py +++ b/astar.py @@ -21,12 +21,10 @@ def astar(obiekty, start, cel): gscore = {start: 0} fscore = {start: heurystyka(obiekty, start, cel)} oheap = [] - dodatkowy_koszt = 0 heapq.heappush(oheap, (fscore[start], start)) while oheap: current = heapq.heappop(oheap)[1] if current == cel: - #obiekty["plansza"][current[0], current[1]].setKolor((255, 0, 0)) data = [] while current in came_from: @@ -34,7 +32,6 @@ def astar(obiekty, start, cel): current = came_from[current] return data[::-1] close_set.add(current) - #obiekty["plansza"][current[0], current[1]].setKolor((255, 0, 0)) for i, j in sasiedzi: sasiad = current[0] + i, current[1] + j @@ -54,5 +51,4 @@ def astar(obiekty, start, cel): fscore[sasiad] = tentative_h_score + gscore[current] gscore[sasiad] = gscore[current] + heurystyka(obiekty, current, sasiad) heapq.heappush(oheap, (fscore[sasiad], sasiad)) - #obiekty["plansza"][sasiad[0], sasiad[1]].setKolor((0, 255, 0)) return False diff --git a/game.py b/game.py index debec6a..ec34c3d 100644 --- a/game.py +++ b/game.py @@ -89,11 +89,7 @@ def game(): obiekty["smieciarka"].astar_move(obiekty, (obiekty["smieciarka"].x, obiekty["smieciarka"].y), cel) clock.tick(7) - #start = obiekty["plansza"][0, 14] - #koniec = obiekty["plansza"][14, 0] - #print(astar.astar(obiekty, (0, 14), (14, 0))) - #print(len(astar.astar(start, koniec))) pygame.quit() diff --git a/modele.py b/modele.py index 36f4fc2..eea9117 100644 --- a/modele.py +++ b/modele.py @@ -25,7 +25,6 @@ class Smieciarka(pygame.sprite.Sprite): def __init__(self, x, y): self.x = x self.y = y - self.pozycja = (self.x, self.y) self.image = pygame.image.load('resources/plansza/smieciarka.png') self.obraz = None self.ruch = 1