Commit 7aaa0235 authored by Grégoire PETIT's avatar Grégoire PETIT
Browse files

height -> size (clearer)

parent 01a0fc5e
...@@ -85,8 +85,8 @@ def voisins(graphe,x,y): ...@@ -85,8 +85,8 @@ def voisins(graphe,x,y):
flat.append(point) flat.append(point)
return(flat) return(flat)
def neighbors(node, height): def neighbors(node, size):
#height represent the whole size of the image #size represent the whole size of the image
my_neighbors =[] my_neighbors =[]
x,y = node[0],node[1] x,y = node[0],node[1]
...@@ -96,15 +96,15 @@ def neighbors(node, height): ...@@ -96,15 +96,15 @@ def neighbors(node, height):
my_neighbors.append((x,y-1)) my_neighbors.append((x,y-1))
if x-1>=0 and y-1>=0: if x-1>=0 and y-1>=0:
my_neighbors.append((x-1,y-1)) my_neighbors.append((x-1,y-1))
if x+1<height[0]: if x+1<size[0]:
my_neighbors.append((x+1,y)) my_neighbors.append((x+1,y))
if y+1<height[1]: if y+1<size[1]:
my_neighbors.append((x,y+1)) my_neighbors.append((x,y+1))
if x+1<height[0] and y+1<height[1]: if x+1<size[0] and y+1<size[1]:
my_neighbors.append((x+1,y+1)) my_neighbors.append((x+1,y+1))
if x+1<height[0] and y-1>=0: if x+1<size[0] and y-1>=0:
my_neighbors.append((x+1,y-1)) my_neighbors.append((x+1,y-1))
if y+1<height[1] and x-1>=0: if y+1<size[1] and x-1>=0:
my_neighbors.append((x-1,y+1)) my_neighbors.append((x-1,y+1))
return my_neighbors return my_neighbors
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment