A pathfinding solution

well it seems stupid but i dont know how :confused:
i just started programming few month ago