Sunday, 27 February 2011

GridWorld page 30



1
What methods are implemented inCritter?  
The following methods are implemented:
-          act()
-           getActors()
-           getMoveLocation()
-          electMoveLocation()
-          processActors()
-           makeMove() 
2
What are the five basic actions common to all critters when they act?  
They get actors and they process the actor, they get move locations, they choose a block to move to and finally they move. 
3
Should subclasses of Critter override thegetActors()   method?

Explain
They can have it, if they get actor, and want to change location or change the colour.   
4
Describe three ways that a critter could process actors.  
Rearrange the placements of the objects inside the  grid, removing all rocks, changing colour of the flowers
5
What three methods must be invoked to make a critter move?

Explain each of  these methods.  
Three methods are:
-          getMoveLocations()
-          selectMoveLocation()
-          makeMove()

1.       getMoveLocations() gives us a list of all the moving possible locations on the grid
2.       selectMoveLocation() selects a location on the list of locations
3.       makeMove then moves object to the chosen spot.   
6
Why is there no Critter constructor?  
It extends colour.


No comments:

Post a Comment