import stanford.karel.*;
public class StoneMasonKarel extends SuperKarel {
public void run() {
fixBeeper();
}
private void fixBeeper() {
upColumn();
downColumn();
if(frontIsClear()) {
moveToNextColumn();
fixBeeper();
}
}
private void upColumn() {
turnLeft();
while(frontIsClear()) {
if(noBeepersPresent()) {
putBeeper();
}
move();
}
if(noBeepersPresent()) {
putBeeper();
}
}
private void downColumn() {
turnAround();
while(frontIsClear()) {
move();
}
turnLeft();
}
private void moveToNextColumn() {
for(int i=0; i<4; i++) {
move();
}
}
}