astar #4

Merged
s459313 merged 7 commits from astar-2 into master 2022-04-29 04:38:00 +02:00
Showing only changes of commit 5760a51d5f - Show all commits

8
board
View File

@ -158,10 +158,10 @@ def kb_listen(objectArray, gridLength):
#moje
def manhattan(field1, field2):#nasze punktyNOWE
tuple1 = zip(field1, field2)#łączymy xpos1 z xpos2 i ypos1 z ypos2
for i, j in tuple1:
distance = sum(abs(i - j))#dodajemy wartości bezwzględne różnic x i y
def manhattan(node1, node2):
x1, y1 = node1.state[0], node1.state[1]
x2, y2 = node2.state[0], node2.state[1]
distance = abs(x1 - x2) + abs(y1 - y2)
return distance