Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package bellgridworld;
  2. import info.gridworld.actor.Critter;
  3. import info.gridworld.grid.*;
  4. import java.util.ArrayList;
  5. public class BellTestBug extends Critter{
  6. private int steps;
  7. private int sideLength, nuke, count;
  8. public BellTestBug(){
  9. sideLength = 0;
  10. count = 0;
  11. }
  12. public void act(){
  13. ArrayList locs = getGrid().getValidAdjacentLocations(getLocation());
  14. for(int i = 0; i < locs.size(); i++){
  15. new BellTestBug().putSelfInGrid(this.getGrid(), (Location)locs.get(i));
  16. }
  17. move();
  18. }
  19. public void move()
  20. {
  21. ArrayList asdf = getGrid().getOccupiedLocations();
  22. for(int f = 0; f < asdf.size(); f++)
  23. if(!(getGrid().get((Location) asdf.get(f)) instanceof BellTestBug))
  24. {
  25. makeMove((Location) asdf.get(f));
  26. return;
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement