aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

Hurdles 3 won't stop at goal #462

Closed aleaguilar closed 7 months ago

aleaguilar commented 7 months ago

Sometimes when goal is at position (13, 1) the robot won't stop at it and keep walking.

I've noticed it always happens at that same spot and the number of steps is always 1002

Screenshot 2023-12-16 at 7 55 42 PM

aleaguilar commented 7 months ago

This one is in Hurdles 4

Screenshot 2023-12-16 at 7 59 49 PM

aroberge commented 7 months ago

All worlds solutions take much fewer than 1000 steps. To avoid infinite loops (programs that never end), the number of steps allowed is set to 1000 (and Reeborg takes usually an extra two steps). When this number is reached, the program ends with an error. If you look at your screenshot, you will see that the instruction highlighted is not while not at_goal(). Your program is still executing instructions without a proper way to end. A properly written program would have made Reeborg stop at the flag.

Try to start your program with the following instruction:

set_max_nb_steps(1200)

You will see that Reeborg will take 1202 steps instead of 1002, and it will still not stop at the goal correctly.