Professional Documents
Culture Documents
Stone Mason Karel
Stone Mason Karel
* File: StoneMasonKarel.java
* --------------------------
* The StoneMasonKarel subclass solves the "repair the quad"
* problem from Assignment 1.
*/
import stanford.karel.*;
while (frontIsClear()) {
repairColumn();
}
while(frontIsBlocked()) {
if (facingNorth()){
goBack();
if (frontIsClear()){
changeColumn();
repairColumn();
}
}
}
}
/*
* Pre-condition = facing East at the bottom of the world
* Post-condition=facing North and front is blocked at the top of
the world.
* makes Karel repair a whole column using beepers
*/