//2.2.3
void addSlow(){
while(frontIsClear()){
decrement();
if(frontIsClear()){
LaufeZurueck();
increment();
LaufeZurueck();
}
}
}
void decrement(){
while(!onBeeper() && (frontIsClear())){
dropBeeper();
moveForward();
}
if(onBeeper()){
pickBeeper();
}
}
void increment(){
while(onBeeper() && (frontIsClear())){
pickBeeper();
moveForward();
}
if(!onBeeper()){
dropBeeper();
}
}
void LaufeZurueck(){
turnAround();
while(frontIsClear()){
moveForward();
}
Wechsel();
}
void Wechsel(){
if(!frontIsClear() &&(!leftIsClear())){
turnRight();
moveForward();
turnRight();
}
if(!frontIsClear()){
turnLeft();
moveForward();
turnLeft();
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter