void quantizeBits() {
repeat (10) {
if (onBeeper()) {
updateCode();
}
if (frontIsClear()) {
moveForward();
}
}
}
void updateCode() {
turnLeft();
repeat (5) {
moveForward();
}
if (onBeeper()) {
while (frontIsClear()) {
moveForward();
if (!onBeeper()) {
dropBeeper();
}
}
turnAround();
while (frontIsClear()) {
moveForward();
}
} else {
turnAround();
repeat (5) {
moveForward();
if (onBeeper()) {
pickBeeper();
}
}
}
turnLeft();
}