None of the if statements and not even the while condition are being read and I don't understand why. I even put a print statement before to see if it was right.
potential_contour=[['2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2'], ['2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2'], ['2', '2', '2', '0', '0', '0', '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', '2', '2', '2'], ['2', '2', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '2', '2'], ['2', '2', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '2', '2'], ['2', '2', '2', '0', '0', '0', '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', '0', '0', '2', '2', '2'], ['2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2'], ['2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '2', '2', '0', '0', '0', '0', '0', '0', '0', '2', '2', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'], ['2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2']]
for initial_x in range(21):
for initial_y in range(21):
potential=0
for _ in range (5):
x,y= initial_x, initial_y
print(potential_contour[x][y])
while(potential_contour[x][y]==0):
choice=random.randint(0,3)
if choice==0: x+=1
elif choice==1: x-=1
elif choice==2: y+=1
elif choice==3: y-=1
print(potential_contour[x][y])
if potential_contour[x][y]==1: potential+=100 #or x==box_dim
elif potential_contour[x][y]==2: potential+=200
Aucun commentaire:
Enregistrer un commentaire