![]() |
Problem Set 4 |
Task 1 Notes, Hints, Suggestions
Follower
methods that you find helpful. In particular,
you may find it helpful to define methods that return a boolean
value indicating the position of the next bagel relative to the
buggle's current position and heading.
For example, it is a good idea to define a helper method with
the following specification:
public boolean isBagelInFront();
Returnstrue
if there is a cell with a bagel in front of this buggle andfalse
otherwise.
This method is similar to the isFacingTrail()
method
presented in Lecture #9.
It is also a good idea to define methods that check
for a bagel to the left or right of a buggle.
tick()
method takes less
than 20 lines, much of which is whitespace, comments, and method
headers.setDimensions()
method within
the setup()
method of the FollowWorld
class.