|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.collegeboard.gridworld.actor.Actor
com.collegeboard.gridworld.actor.AbstractCritter
com.collegeboard.gridworld.actor.SimpleCritter
public class SimpleCritter
A simple critter is a critter with basic implementations of the abstract methods of Critter. It does nothing to its neighbors and then moves to a random empty neighboring location.
copyright© 2005 Cay S. Horstmann (http://horstmann.com)
| Constructor Summary | |
|---|---|
SimpleCritter()
|
|
| Method Summary | |
|---|---|
ArrayList<Location> |
getMoveLocations()
Get the possible locations for the next move. |
ArrayList<Actor> |
getNeighbors()
Get the neighbors for processing. |
void |
makeMove(Location loc)
Moves this critter to the given location. |
void |
processNeighbors(ArrayList<Actor> neighbors)
Process the critter's neighbors. |
Location |
selectMoveLocation(ArrayList<Location> locs)
Selects the location for the next move. |
| Methods inherited from class com.collegeboard.gridworld.actor.AbstractCritter |
|---|
act |
| Methods inherited from class com.collegeboard.gridworld.actor.Actor |
|---|
getColor, getDirection, getGrid, getLocation, moveTo, putSelfInGrid, removeSelfFromGrid, setColor, setDirection, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleCritter()
| Method Detail |
|---|
public ArrayList<Actor> getNeighbors()
AbstractCritter
getNeighbors in class AbstractCritterpublic void processNeighbors(ArrayList<Actor> neighbors)
AbstractCritter
processNeighbors in class AbstractCritterneighbors - the neighbors to be processedpublic ArrayList<Location> getMoveLocations()
AbstractCritter
getMoveLocations in class AbstractCritterpublic Location selectMoveLocation(ArrayList<Location> locs)
AbstractCritter
selectMoveLocation in class AbstractCritterlocs - the possible locations for the next move
public void makeMove(Location loc)
AbstractCritter
makeMove in class AbstractCritterloc - the location to move to (must be valid)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||