Building a route based on incomplete data

Please tell me an adequate algorithm for finding the path(or at least where to look).

There is a 2d scene(more precisely, a screenshot). We have: The entire area (initially it is in a fog + the shape changes from generation to generation and is not predicted) Scope (the area around the object is always a fixed size with the object in the center) The object(actually will move). Exit / entry point(start and end of the loop here)

Roughly I imagine how it should be look (screenshots) enter a description of the image here

Next, a screenshot of the approximate scope of each step:

enter a description of the image here

Question: What should I do(code advice, etc.) to make the object move parallel to the edge of the area?

It is planned to do this in python3

Perhaps important points. It would be great: Remember the position of each "step" and add it up(this is not difficult). Remember the entire area(it is possible that the generation will be repeated after all) Neyronka?!

Author: Beer And Bear, 2020-11-25