1 | page 30 What methods are implemented in Critter? The act(), getActors(), processActors(), getMoveLocations(), and selectMoveLocation() methods are implemented in Critter, although it still contains methods from it's superclass Actor. | ||||||||||||||||||
2 | What are the five basic actions common to all critters when they act? The actors are collected from the grid, they all invoke the processActors() method, they get their moves through getMoveLocations(), they select a location through selectMoveLocation(), and finally make a move through makeMove(). | ||||||||||||||||||
3 | Should subclasses of Critter override the getActors() method? Explain No, because the getActors() method is used to collect all actors on the grid, and if a subclass of critter overrides it, it might not even get to act because it won't be collected into the list of actors. | ||||||||||||||||||
4 | Describe three ways that a critter could process actors. It could change the state of the critter and the actor, it could change the state of the critter based on the actor, or change the actor (i.e. removing it). | ||||||||||||||||||
5 | What three methods must be invoked to make a critter move? Explain each of these methods. processActors(), getMoveLocations(), and selectedMoveLocation() must be implemented in order for the critter to move. | ||||||||||||||||||
6 | Why is there no Critter constructor? This is because the critter class is an abstract class. Furthermore, it implements methods for its subclasses to use, but can't make any objects. page 33
|
Tuesday, 22 February 2011
Grid World Part 4 part 1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment