The previous level 10 maze solution is quite complicated and doesn’t use the tip to follow the left wall.
The answer in the video above follows the left wall, uses fewer lines of javascript code and is far more elegant (the best answer).
Google Blockly Games Maze 10 Solution
Congratulations!
You solved this level with 10 lines of JavaScript:
while (notDone()) {
if (isPathLeft()) {
turnLeft();
}
if (isPathForward()) {
moveForward();
} else {
turnRight();
}
}
Are you ready for the next challenge?
Continue Reading Google's Blockly Games Maze 1-10 Solutions
while (notDone()) {
if (isPathForward()) {
if (isPathLeft()) {
if (isPathRight()) {
turnRight();
} else {
turnLeft();
}
}
} else {
if (isPathLeft()) {
turnLeft();
} else {
turnRight();
}
}
moveForward();
}