CompSci 4 - Classwork - Nov. 17, 2005
5 pts
Today's classwork goes along with Chapter 8, Section 1.
The following work needs to be checked off when you have completed it.
- Load the animation Chap08HorseRace.a2w from the CPS 4 web page
under the calendar for today. Run the animation to see what it does.
For the following, write down to turn in an explanation of what happens.
Consider the Race method.
- What happens if you move the recursive call to
right after the if/else statement? Explain.
- What happens if you move the recursive call to between the Else and
the
call racehorseGame.moveRandomHorseForward? Explain.
- What happens if you move the recursive call to between whichHorseWon
saying
"I won" and the Else? Explain.
- Load the animation BunnyInGarden.a2w from the CPS 4 web page.
Write the recursive method world.BunnysMeet to do the following.
- Two bunnys, bunny and bunny2, repeatedly hop towards each other at
the
same time as long as they are > 3 meters apart.
- If they are close <= 3 meters apart but still at least 2 meters
apart, 1 bunny hops once and they stop hopping.
- When the bunnys are no longer hopping they bow to each other at the
same time.
If you finish early, feel free to embelish your animations.