Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: StoneMasonKarel.java
- * --------------------------
- * The StoneMasonKarel subclass as it appears here does nothing.
- * When you finish writing it, it should solve the "repair the quad"
- * problem from Assignment 1. In addition to editing the program,
- * you should be sure to edit this comment so that it no longer
- * indicates that the program does nothing.
- */
- import stanford.karel.*;
- public class StoneMasonKarel extends SuperKarel {
- public void run () {
- turnLeft();
- fixColumn();
- turnRight();
- for (int i=0; i<4;i++){
- move();
- }
- turnRight();
- fixColumn();
- turnLeft();
- for (int i=0; i<4;i++){
- move();
- }
- turnLeft();
- fixColumn();
- turnRight();
- for (int i=0; i<4;i++){
- move();
- }
- turnRight();
- fixColumn();
- turnLeft();
- }
- public void fixColumn(){
- for (int i=0; i<4;i++){
- while (noBeepersPresent()){
- putBeeper();
- }
- move();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement