1. What is the role of the instance variablesideLength? | Number of moves until the bug turns |
2. What is the role of the instance variablesteps? | Counts amount of steps. |
3. Why is the turn() method called twice when steps becomes equal to sideLength? | One call turns it 45 degrees, we want it to turn 90 degrees. |
4. Why can the move() method be called in the BoxBug class when there is no move() method in the BoxBug code? | It is defined in the Bug class and inherits it. |
5. After a BoxBug is constructed, will the size of its square pattern always be the same? Why or why not? | Nope, there is no way to change it's size after it's constructed. |
6. Can the path a BoxBug travels ever change? Why or why not? | If it reaches the edge or if it comes to face something. |
7. When will the value of steps be zero? | When the bug turns. |
יום שני, 14 בפברואר 2011
Gridworld: Part 2: Bug Variations: Set 2: Page 12
הירשם ל-
תגובות לפרסום (Atom)
אין תגובות:
הוסף רשומת תגובה