Professional Documents
Culture Documents
class program {
void turnoeste() {
while(notFacingWest){
turnleft();
}
}
void detectwall(){
while(frontIsClear()){
move();
}
}
void turneste() {
while(notFacingEast){
turnleft();
}
}
void pickbeepers(){
while(frontIsClear()){
pickall();
move();
}
pickall();
}
void pickall(){
while(nextToABeeper){
pickbeeper();
}
}
void movenorth(){
while(rightIsBlocked){
move();
}
}
void jumpfence(){
move();
iterate(3) turnleft();
}
void movesouth(){
while(frontIsClear()){
move();
}
}
void putbeepers(){
while(anyBeepersInBeeperBag){
putbeeper();
}
}
program () {
turnoeste();
detectwall();
turneste();
pickbeepers();
turnleft();
movenorth();
turneste();
jumpfence();
movesouth();
putbeepers();
turnoff();
}
}