Sunday, 27 February 2011

GridWorld Page 23


1
Name three properties of every actor.  
The three fields are color, location and direction.
2
When an actor is constructed, what is its direction and color?  
The colour is blue and direction is set to  
3
Why do you think that the Actor class was created as a class instead of an interface?
4
Can an actor put itself into a grid twice without first removing itself? Can an actor remove itself from a grid twice? Can an actor be placed into a grid, remove itself, and then put itself back? Try it out. What happens?  
3. Firstly because some methods are implemented. 
4. It will give you an error if you try to put it in the grid twice. We are allowed to replace, that means placing something completely new instead of the old one, but you cannot put it in twice.
5
How can an actor turn 90 degrees to the right? 
by using the setdirection method. 

No comments:

Post a Comment