1 Replies - 7395 Views - Last Post: 22 March 2013 - 06:16 PM Rate Topic: -----

#1 n00l3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 17-August 11

Critter Eats Everything Around It?

Posted 04 May 2012 - 07:02 PM

I have a grid like this
Posted Image
and click Step.

ArrayList<Actor> actors = getActors();
is
return getGrid().getNeighbors(getLocation());

getNeighbors return Locations adjacent to the Critter's Location (where all the bugs are)
processActors(actors);

all bugs die
ArrayList<Location> moveLocs = getMoveLocations();
Location loc = selectMoveLocation(moveLocs);
makeMove(loc);

Critter moves to any adjacent location. (they should all be empty)

But, when I click step, the bugs on the lower two thirds of the 3x3 square are dead, and the top 3 bugs move up... Why aren't the top 3 bugs eaten?

Is This A Good Question/Topic? 0
  • +

Replies To: Critter Eats Everything Around It?

#2 Zode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-March 13

Re: Critter Eats Everything Around It?

Posted 22 March 2013 - 06:16 PM

The top three bugs move before the thing that eats them. GridWorld tells each actor to act based on its position in the grid. It reads from left to right starting at (0,0). :bananaman:/>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1