Writen by Chris Piech
Day1: BeeperLine.java
Your goal is to fill the first row of Karel's world with beepers. You can assume that Karel starts in the bottom left corner, facing east. For example, if you ran your program on the world on the left, it should produce the world on the right.
/** * Program: BeeperLine * ------------------- * Fill the first row with beepers. Assumes that Karel starts out in * the bottom left corner of the screen, facing east. */ public class BeeperLine extends SuperKarel { public void run() { while(frontIsClear()) { putBeeper(); move(); } // This line is necessary to place the final beeper. The number // of times Karel moves is one less than the number of times karel // places a beeper (if the world is five squares wide, we place // 5 beepers but only move 4 times putBeeper(); } }