You are on page 1of 5

GridWorld Case Study Name:

GWExercises02

Date: Period:

Execute GridWorldLab01-Ch03 or GridWorldLab02-Ch04, click RUN and observe the grid display.
1. Explain the Bug behavior. The bug behavior is that they keep going straight until they hit the wall or another actor in which they turn a certain number of degrees and then they go straight in that direction. They always turn right 2 motions. As they go straight, they leave the color of the flower behind. 2. Explain the Actor behavior. The actor behavior is that they continuously turn in a clockwise motion. 3. Explain the Rock behavior. The rock behavior is that they stay in the same location and they standstill. 4. Explain the Flower behavior. The flowers are created every time a bug goes to a grid and then leaves it and the color the bug was is the color of the flower that is left behind. 5. What happens when a Bug object runs into a Flower object? It goes over the grid and when it leaves the grid it leaves a flower there of the color that it is. 6. What happens when a Bug object runs into a Rock object? When it runs into a Rock it turns two motions to the right and then goes straight. 7. What happens when a Bug object runs into the grid wall? it runs into a wall it turns two motions to the right and then goes straight. 8. Will you need to create a GridWorld JAR file library for each of the future lab assignments? No

GridWorld 2010, APCS Edition

GWExercises02

Page 1

06-21-10

9. Who is the primary author of the GridWorld program? K Horseman

10.

What single, very important file is located in the NoTouchCode folder? The Grid World file is in there and then the build properties file.

11.

How can you determine the available methods of a GridWorld object?

Right click on the object. In questions 12-15 you will be listing methods. You only need to list the name of the method. Example: instead of info.gridworld.grid.Location getLocation, just list getLocation. 12. List all of the Actor methods.

Move to(); putSelfInGrid(); setColor(); setGrid(); removeSelfFromGrid(); getLocation(); getGrid(); setDirection(); 13. List all of the Bug methods that have a Bug icon in front of them. (These are the methods that were not inherited from Actor.) act(); canMove(); move(); turn();

14. List the only Flower method that has a Flower icon in front of it. (This is the one method that was not inherited from Actor.) act();

15. List the only Rock method that has a Rock icon in front of it. (This is the one method that was not inherited from Actor.)
GridWorld 2010, APCS Edition GWExercises02 Page 2 06-21-10

act(); 16. What are the methods the four classes have in common?

act(); 17. What happens if you move the mouse pointer on top of an empty cell, but do not click on it?

It gives you the location on the grid. 18. What happens if you move the mouse pointer on top of an object in the grid, but do not click on it?

It gives the location, the color, direction.

19.

What happens if you use the moveTo method to move an object to a Location where another object already exists?

It just goes over it. 20. What happens if you use the moveTo method to move an object to Location (10,10) ?

Error 21. What happens if you use the moveTo method to move an object to Location (-1,-2) ?

Error 22. Look at your answers to previous 2 questions. They should be the same. Why did this result occur in both cases? Because the location was not available in both cases. 23. Which direction do Bug objects face when they are first created?

north 24. If you click on a Bug object and select the turn method, how many degrees does it turn?

It moves 45 degrees northeast 25. Refer to the previous two questions. How many times would a Bug object need to be turned so that it faces the same direction it initially did when it was first created? 8 times
GridWorld 2010, APCS Edition GWExercises02 Page 3 06-21-10

26. Which of these classes: Actor, Bug, Flower and Rock will not let you specify a color when creating a new object from that class? Actor 27. Yes Refer to the previous question. Even though object of that class cannot be created with anything but the default color, is there a way to change the objects color after it is created? If so, how?

GridWorld 2010, APCS Edition

GWExercises02

Page 4

06-21-10

Questions 28-30 refer to this grid.

28.

How many objects are in the grid above?

16 objects 29. How many classes are in the grid above?

5 classes 30. If the Step or the Run button were to be clicked, would there be more objects in the grid, or less? Explain your answer. More because the bug object causes more to be created and the bugs continually move.

GridWorld 2010, APCS Edition

GWExercises02

Page 5

06-21-10