Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package LopezBugs;
  2. import info.gridworld.actor.*;
  3. import java.util.ArrayList;
  4. import info.gridworld.grid.*;
  5. public class lopezBasicBug extends Critter {
  6.  
  7.  
  8. public void act(){
  9. ArrayList<Location> emptyLocs = getGrid().getEmptyAdjacentLocations(getLocation());
  10. for(Location x: emptyLocs)
  11. new lopezBasicBug().putSelfInGrid(getGrid(), x);
  12. ArrayList<Location> enemyLocs = getGrid().getOccupiedAdjacentLocations(getLocation());
  13. for(Location x: enemyLocs)
  14. if(!(getGrid().get(x) instanceof lopezBasicBug))
  15. new lopezBasicBug().putSelfInGrid(getGrid(), x);
  16.  
  17.  
  18. }//Method Act
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement