Ch 6 GridWorld Flashcards
locatin of location class
info.gridworld.grid.Location
location of Grid interface
info.gridworld.grid.Grid
location of Actor class
info.gridworld.actor.Actor
all the bug, folwer, rock, critter, sub critters and sub bug are located here as well (info.gridworld.actor) and extend Actor
the runner classes ( e.g. BoxBugRunner)
are not tested on the AP exam
You need to know the documentation (API) for
the Grid interface, Location class, and Actor, Flower, and Rock classes.
You need to know the implementations (code) for
Bug, BoxBug, Critter, Chameleon Critter
a runner class
configures the grid and supplies a main method for a particular object
Location objects are
immutable; once created they can not change.+
grid’s put and remove methods should
never be used directly - use Actor’s putSelfInGrid and removeSelfFromGrid instead.
otherwise the actor won’t know that it was put in he grid, or the actor will “htink” it is sitlll in the grid while it no longer is.
a critter
is an actor that can interact with other actors in a more sophisticated way.
Critter’s act method
1 get a list of actors to interact with
2 process actors form that list
3 get a list of locations that are candidates for this critter’s next move
4 select a location to move to from the list obtained in step 3
5 move to the selected location
ap exam questions may ask you to reason about or to write a subclass of
critter
a critter is an actor that ____ processes some other actors,____ moves
first, then
for critter, getactors, getmovelocations, and selectmovelocation must
leave the state of all actors unchanged
for critter, processactors can
only change hte staet of this critter and the actors in hte given list, and itm ust leave the location of this critter unchange