I have beaten the game with the following code:
def func(): gx = -100 gy = -100 found = False d = 20 for xx in range(4, d): say(xx) for yy in range(-d, d): if is_goal(get_pos_x()+xx, get_pos_y()+yy): gx = get_pos_x() + xx gy = get_pos_y() + yy found = True break if found: break print(gx, gy) dx = 1 if gx < get_pos_x(): dx = -1 dy = 1 if gy < get_pos_y(): dy = -1 while get_pos_x() != gx or get_pos_y() != gy: if get_pos_x() != gx and not is_block(get_pos_x() + dx, get_pos_y()): print(get_pos_x(), gx) move(dx, 0) else: move(0, dy) submit() func()
Speaking of minor issues, I noticed that sometimes when resizing a window (specifically, enlarging), line numbers move separately from code.