Now that your isFacingTrail()
method is working, it's time
to write the code to organize the hunting party. Copy/paste your code from the
previous exercise, and complete the hunt()
method.
Following a track is not very difficult: move forward as long as you have the track in front of you. If there is not track in front of you anymore, check if the rest of the track is on your left or on your right, and follow it further.
To ensure that you don't mix the track you come from with the one in front of you,
the easier is to erase the track when you follow it. Use the method brushDown()
to put your brush down and mark the ground, and brushUp()
to move it up again.
Finally, do not forget to capture your prey once you found it (using pickupBaggle()
).
hunt()
method. You probably want to copy over the
isFacingTrail()
method that you wrote in previous exercise.