Slug Tracking

Your buggle is super happy! It just found the green dribbling trail, certainly left by a big yummy slug. At its end, the buggle is certain to entertain itself with this appetizing slug (represented as a baggle).

To reach that goal, you had to write a boolean method isFacingTrail, which determines whether we are facing a green cell or not. Of course, if we are facing a wall, it should return false without bumping into it. You should make sure that this method has no side effect, i.e. that it does not change the state of the calling buggle nor of its world.

Your tool to that end is the getGroundColor() that returns the color of the current cell. Just go to the cell you want to test and run that function. [!java]You cannot test whether this color is equal to Color.green with an == sign but instead you have to write something like getGroundColor().equals(Color.green). This is because green is an object in Java, and .equals() is the way to go to test equality between Java objects.[/!] [!python|scala|c]So you just have to test whether the returned color is equal to the value [!scala|python]Color.green[/!][!c]GREEN[/!], that represents the green color.[/!]

Exercise goal

Complete the isFacingTrail() method (which gets called automatically).