thx, was just thinking of the first move, you’re right to make the zig zag i also need to add that rule to take the different choice from previous. I added a plot in jupyter to take a look at thing for debugging:
# Plot
area = 20
plt.scatter([loc[0] for loc in path], [loc[1] for loc in path], s=area, c="black", alpha=1)
plt.scatter([loc[0] for loc in barriers], [loc[1] for loc in barriers], s=70, edgecolors="red", c="none", alpha=1)
plt.scatter([x for x in range(0,14)], [y for y in range(13,-1,-1)], s=70, c="green", marker="s", alpha=1)
plt.scatter([x for x in range(0,14)], [y for y in range(14,28)], s=70, c="green", marker="s", alpha=1)
plt.scatter([x for x in range(14,28)], [y for y in range(27,13,-1)], s=70, c="green", marker="s", alpha=1)
plt.scatter([x for x in range(14,28)], [y for y in range(0,14,1)], s=70, c="green", marker="s", alpha=1)
plt.title('terminal path debug')
plt.xlabel('x')
plt.ylabel('y')
plt.show()