Guest User

Untitled

a guest
Jun 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import info.gridworld.actor.*;
  2.  
  3.  
  4. class ZBug extends Bug
  5. {
  6.     int length;
  7.     int counter =0;
  8.     int n = 0;
  9.     boolean breaker = false;
  10.     public ZBug(int x)
  11.     {
  12.         length = x;
  13.     }
  14.  
  15.     public void act()
  16.     {
  17.         if(!(breaker))
  18.         {
  19.             turn();
  20.             turn();
  21.         }
  22.  
  23.         while(n != ((2 * length) + 1))
  24.         {
  25.  
  26.  
  27.             if(counter != length && canMove())
  28.             {
  29.                 move();
  30.                 counter++;
  31.             }
  32.  
  33.             else
  34.             {
  35.                 turn();
  36.                 turn();
  37.                 turn();
  38.                 while(counter != 0)
  39.                 {
  40.                     move();
  41.                     counter--;
  42.                 }
  43.  
  44.                 turn();
  45.                 turn();
  46.                 turn();
  47.                 turn();
  48.                 turn();
  49.             }
  50.             n++;
  51.         }
  52.  
  53.     breaker = true;
  54.  
  55.     }
  56. }
Add Comment
Please, Sign In to add comment