解决这个 Google 块状迷宫
Solve this Google Blockly maze
如果能帮助我完成这个方块迷宫,我将不胜感激。
https://blockly-games.appspot.com/maze?lang=en&level=10&skin=0
这是我能达到的程度。
不确定它是否是最佳解决方案,但它有效:
while (notDone()) {
moveForward();
if (isPathLeft()) {
if (isPathForward()) {
if (isPathRight()) {
turnRight();
} else {
turnLeft();
}
} else {
turnLeft();
}
} else {
if (isPathRight()) {
turnRight();
}
}
}
如果能帮助我完成这个方块迷宫,我将不胜感激。
https://blockly-games.appspot.com/maze?lang=en&level=10&skin=0
这是我能达到的程度。
不确定它是否是最佳解决方案,但它有效:
while (notDone()) {
moveForward();
if (isPathLeft()) {
if (isPathForward()) {
if (isPathRight()) {
turnRight();
} else {
turnLeft();
}
} else {
turnLeft();
}
} else {
if (isPathRight()) {
turnRight();
}
}
}