Update 'board'

This commit is contained in:
Gabriela Piekarska 2022-04-27 21:52:09 +02:00
parent 3680e50105
commit 5760a51d5f

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