I’m attempting to code microbit to use a cutebot to solve any maze. I understand the idea of maze solving algorithms but am having trouble coding it.
My biggest issue is having trouble getting the cutebot to turn the same amount each time. In the mazes I’ve tried so far, the algorithm should work but it tends to undershoot turning left and overshoot when it turns around. I also think it executes the nested If statements in ways that I wasn’t expecting - am I doing something wrong there?
Does anyone have any ideas of what I could do to improve my code?
The idea was for the cutebot to move forward until it comes to a wall. Then, it should turn left and check for a wall after turning. If there is a second wall after turning left, I wanted it to turn round and restart the loop. If it did not see a wall, I wanted it to continue forward.
A big issue I’ve been having is getting the bot to turn at intervals of 90 degrees, and I think the logic of my conditionals is off.