Skip to content

Commit 1a769ac

Browse files
the point can not just do back
1 parent 0155121 commit 1a769ac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

24.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def main():
66
logging.basicConfig(filename="maze/24.log", filemode="w", level=logging.DEBUG,
7-
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
7+
format='%(asctime)s=>%(message)s')
88
file_path = "maze/maze.png"
99
im = first_step(file_path)
1010
im_size = im.size
@@ -108,8 +108,9 @@ def find_next_point(im, x, y, ok_points, way):
108108
logging.debug("way={}, x={}, y={}, right_x_pixel={}, left_x_pixel={}, up_y_pixel={}, down_y_pixel={}".format(way, x, y, right_x_pixel, left_x_pixel,
109109
up_y_pixel, down_y_pixel))
110110
for point in points:
111-
if point in ok_points:
112-
logging.debug("way={}, remove point={}".format(way, point))
111+
now_index = ok_points.index((x, y))
112+
before = ok_points[now_index - 1]
113+
if before == point:
113114
points.remove(point)
114115
if len(points) < 1:
115116
# print("points为None,x={}, y={}".format(x, y))

0 commit comments

Comments
 (0)