package boxBug; /** * @author tzaki * @version 9/30/08 */ import info.gridworld.actor.Bug; /** * A <code>CircleBug</code> traces out an octagonal circle of a given size. */ public class CircleBug extends Bug { private int steps; private int sideLength; /** * Constructs a box bug that traces a square of a given side length * @param length the side length */ public CircleBug(int length) { steps = 0; sideLength = length; } /** * Moves to the next location of the square. */ public void act() { if (steps < sideLength && canMove()) { move(); steps++; } else { turn(); steps = 0; } } }