X999: cautiousHop

You are writing code for a Jeroo subclass that represents an overly cautious Jeroo. This type of Jeroo only hops if there are no obstacles (water, nets) nearby. Implement the cautiousHop() method so that it only hops forward if there are no obstacles (water, nets) in front or to either side of the jeroo.

Examples:

With a net in front
With no hazards

Your Answer:

Feedback

Your feedback will appear here when you check your answer.