Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //CircleBug.java    MrG 2011.1216
  2. import info.gridworld.actor.Bug;
  3. public class CircleBug extends Bug
  4. {
  5.     private int steps;
  6.     private int sideLength;
  7.  
  8.     public CircleBug(int length)
  9.     {
  10.         steps = 0;
  11.         sideLength = length;
  12.     }
  13.  
  14.     public void act()
  15.     {
  16.         if (steps < sideLength && canMove())
  17.         {
  18.             move();
  19.             steps++;
  20.         }
  21.         else
  22.         {
  23.             turn();
  24.             steps = 0;
  25.         }
  26.     }
  27. }