Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // BEGIN CHANGED
- private int c;
- public BlusterCritter(int c) {
- this.c = c;
- }
- // END CHANGED
- @Override
- public ArrayList<Actor> getActors() {
- int minRow = Math.max(getLocation().getRow() - 2, 0);
- int maxRow = Math.min(getLocation().getRow() + 2, getGrid().getNumRows());
- int minCol = Math.max(getLocation().getCol() - 2, 0);
- int maxCol = Math.min(getLocation().getCol() + 2, getGrid().getNumCols());
- ArrayList<Actor> actors = new ArrayList<>();
- for (int row=minRow; row<maxRow; row++) {
- for (int col=minCol; col<maxCol; col++) {
- Actor actor = getGrid().get(new Location(row, col));
- if (actor != null && actor instanceof Critter) { // CHANGED
- actors.add(actor);
- }
- }
- }
- return actors;
- }
- @Override
- public void processActors(ArrayList<Actor> actors) {
- if (actors.size() < c) {
- // Get lighter
- } else {
- // Get darker
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement