a_star #21

Merged
s464961 merged 15 commits from a_star into master 2022-04-27 19:50:51 +02:00
Showing only changes of commit 55c3ea0aa8 - Show all commits

View File

@ -55,7 +55,7 @@ class Node:
if self.grid[self.state.position[0]][self.state.position[1]] == 'g': if self.grid[self.state.position[0]][self.state.position[1]] == 'g':
self.cost = 1 if not self.parent else self.parent.cost + 1 self.cost = 1 if not self.parent else self.parent.cost + 1
else: else:
self.cost = 3 if not self.parent else self.parent.cost + 3 self.cost = 2 if not self.parent else self.parent.cost + 2
self.depth = 0 if not self.parent else self.parent.depth + 1 self.depth = 0 if not self.parent else self.parent.depth + 1
def __hash__(self) -> int: def __hash__(self) -> int: