Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import info.gridworld.actor.*;
- import info.gridworld.grid.*;
- public class ZBug extends Bug {
- private int steps;
- private int sideLength;
- private int total;
- public ZBug(int length, int totalLength)
- {
- steps = 0;
- sideLength = length;
- total = totalLength;
- }
- public void act()
- {
- if (steps < total && canMove())
- {
- if (steps == 0){
- turn();
- turn();
- steps++;
- }
- else if (steps == sideLength){
- turn();
- turn();
- turn();
- }
- else if (steps == ((sideLength * 2) - 1)){
- turn();
- turn();
- turn();
- turn();
- turn();
- }
- move();
- steps++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment