|
||||||||||
| 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.ChameleonCritter
public class ChameleonCritter
A ChameleonCritter takes on the color of neighboring actors as
it moves through the grid.
The implementation of this class is testable on the AP CS A and AB exams.
| Constructor Summary | |
|---|---|
ChameleonCritter()
|
|
| Method Summary | |
|---|---|
void |
makeMove(Location loc)
Turns towards the new location as it moves. |
void |
processActors(java.util.ArrayList<Actor> actors)
Randomly selects a neighbor and changes this critter's color to be the same as that neighbor's. |
| Methods inherited from class info.gridworld.actor.Critter |
|---|
act, getActors, getMoveLocations, 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 ChameleonCritter()
| Method Detail |
|---|
public void processActors(java.util.ArrayList<Actor> actors)
processActors in class Critteractors - the actors to be processedpublic void makeMove(Location loc)
makeMove in class Critterloc - the location to move to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||