Graphic by Keith Ohlfs |
|
Problem 1 Notes, Hints, Suggestions
public boolean isBagelInFront () { if (isFacingWall()) { return false; } else { brushUp(); // don't change the state of the environment during inquiry forward(); boolean result = isOverBagel(); backward(); brushDown(); // return to original state before inquiry return result; } }
You might also want 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.public void setup() { setDimensions(columns,rows); }