Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package LopezBugs;
- import info.gridworld.actor.*;
- import java.util.ArrayList;
- import info.gridworld.grid.*;
- public class lopezBasicBug extends Critter {
- public void act(){
- ArrayList<Location> emptyLocs = getGrid().getEmptyAdjacentLocations(getLocation());
- for(Location x: emptyLocs)
- new lopezBasicBug().putSelfInGrid(getGrid(), x);
- ArrayList<Location> enemyLocs = getGrid().getOccupiedAdjacentLocations(getLocation());
- for(Location x: enemyLocs)
- if(!(getGrid().get(x) instanceof lopezBasicBug))
- new lopezBasicBug().putSelfInGrid(getGrid(), x);
- }//Method Act
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement