Karel 2.3.3 - jumpTheHurdles

PHOTO EMBED

Thu Aug 11 2022 15:58:56 GMT+0000 (Coordinated Universal Time)

Saved by @bibberhug

void jumpTheHurdles(){
    
    while(!onBeeper()){
        
        if(frontIsClear()){moveForward();}
        
        //checking if still not on beeper, then go another round
        if(!onBeeper()){
            turnLeft(); 
            
            while(!rightIsClear()) { moveForward(); }
            turnRight(); moveForward(); turnRight(); 
            
            while(frontIsClear())  { moveForward(); }
            turnLeft();}
    }
}
content_copyCOPY