連結: 憤怒鳥抓豬遊戲
1.
moveForward();
moveForward();
2.
moveForward();
moveForward();
moveForward();
3.
moveForward();
moveForward();
turnRight();
moveForward();
4.
moveForward();
turnLeft();
moveForward();
turnRight();
moveForward();
5.
turnRight();
moveForward();
turnLeft();
moveForward();
moveForward();
moveForward();
turnLeft();
moveForward();
6.
for (var count = 0; count < 5; count++) {
moveForward();
}
7.
turnRight();
for (var count = 0; count < 5; count++) {
moveForward();
}
8.
for (var count = 0; count < 4; count++) {
moveForward();
}
turnLeft();
for (var count2 = 0; count2 < 5; count2++) {
moveForward();
}
9.
for (var count2 = 0; count2 < 3; count2++) {
for (var count = 0; count < 2; count++) {
moveForward();
}
turnRight();
}
10.
while (notFinished()) {
moveForward();
}
11.
while (notFinished()) {
moveForward();
moveForward();
turnLeft();
}
12.
while (notFinished()) {
moveForward();
turnLeft();
moveForward();
turnRight();
}
13.
while (notFinished()) {
turnRight();
moveForward();
turnLeft();
moveForward();
}
14.
while (notFinished()) {
moveForward();
if (isPathLeft()) {
turnLeft();
}
}
15.
while (notFinished()) {
moveForward();
if (isPathRight()) {
turnRight();
}
}
16.
while (notFinished()) {
moveForward();
if (isPathLeft()) {
turnLeft();
}
}
17.
while (notFinished()) {
moveForward();
if (isPathRight()) {
turnRight();
}
}
18.
while (notFinished()) {
if (isPathForward()) {
moveForward();
} else {
turnLeft();
}
}
19.
while (notFinished()) {
if (isPathForward()) {
moveForward();
} else {
turnRight();
}
}
20.
while (notFinished()) {
if (isPathForward()) {
moveForward();
} else {
if (isPathRight()) {
turnRight();
} else {
turnLeft();
}
}
}