void addFast() {
repeat (8) {
if (onBeeper()) {
moveForward();
if (onBeeper() && beeperAhead()) {
// 1 + 1 + 1
moveForward();
moveForward();
dropBeeper();
nextWithCarry();
} else if (!onBeeper() && !beeperAhead()) {
// 1 + 0 + 0
moveForward();
moveForward();
dropBeeper();
nextWithoutCarry();
} else {
// 1 + 1 + 0 OR 1 + 0 + 1
moveForward();
moveForward();
nextWithCarry();
}
} else {
moveForward();
if (onBeeper() && beeperAhead()) {
// 1 + 1
moveForward();
moveForward();
nextWithCarry();
} else if (!onBeeper() && !beeperAhead()) {
// 0 + 0
moveForward();
moveForward();
nextWithoutCarry();
} else {
// 1 + 0 OR 0 + 1
moveForward();
moveForward();
dropBeeper();
nextWithoutCarry();
}
}
moveForward();
moveForward();
turnAround();
}
}
void nextWithoutCarry() {
turnRight();
moveForward();
turnRight();
moveForward();
}
void nextWithCarry() {
turnRight();
moveForward();
turnRight();
moveForward();
dropBeeper();
}