|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.gridworld.actor.Actor
info.gridworld.actor.Critter
gridWorldTest.CrabCritter
public class CrabCritter
A CrabCritter looks at a limited set of neighbors when it eats and moves.
This class is not tested on the AP CS A and AB exams.
| Constructor Summary | |
|---|---|
CrabCritter()
|
|
| Method Summary | |
|---|---|
java.util.ArrayList<Actor> |
getActors()
A crab gets the actors in the three locations immediately in front, to its front-right and to its front-left |
java.util.ArrayList<Location> |
getLocationsInDirections(int[] directions)
Finds the valid adjacent locations of this critter in different directions. |
java.util.ArrayList<Location> |
getMoveLocations()
Gets a list of possible locations for the next move. |
void |
makeMove(Location loc)
If the crab critter doesn't move, it randomly turns left or right. |
| Methods inherited from class info.gridworld.actor.Critter |
|---|
act, processActors, selectMoveLocation |
| Methods inherited from class info.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 CrabCritter()
| Method Detail |
|---|
public java.util.ArrayList<Actor> getActors()
getActors in class Critterpublic java.util.ArrayList<Location> getMoveLocations()
Critter
getMoveLocations in class Critterpublic void makeMove(Location loc)
makeMove in class Critterloc - the location to move topublic java.util.ArrayList<Location> getLocationsInDirections(int[] directions)
directions - - an array of directions (which are relative to the
current direction)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||