Class Work
Topic 8-1: Butterfly Chase
The purpose of this exercise is to use recursion in solving a problem.
This exercise is based on exercise 2 on page 224 from the Learning to Program with Alice textbook.
Click here to download the initial world.

Use recursion to make the white rabbit chase the butterfly. The butterfly should fly to a random nearby location. The butterfly can move up and down, left and right, and forwards and backwards. Choose a small distance for the butterfly to move. You can choose a different distance for each direction. You must also make sure the butterfly does not fly too low (or it will fly into the ground) or to high. (or the rabbit can't catch it.) To limit the up - down direction of the butterfly movement use an if statement to check the butterfly's distance above (function) the ground. Don't allow the butterfly's motion reduce the distance above the ground below some value or above some value. (You'll have to experiment to find a good values for the minimum and maximum distance above the ground that is allowed.)
Each time the butterfly moves the rabbits turns to face the butterfly and then moves forward some amount. Ensure this amount is enough so that the rabbit will eventually get to within a reasonable distance of the butterfly. When the rabbit is within this reasonable distance it should catch the butterfly with the net.
Remember, use recursion, not a while loop to created repeated motion.
If the method that performs this is called chase the basic outline of the method would be:
| If within catching distance of butterfly: catch butterfly Else Move butterfly random amount Move rabbit call the chase method |