Scenario
Today in lab you are going to help Buggles ben and barb figure out
how to draw a checkerboard. They've brainstormed a lot of possible
ways to draw out a checkerboard in BuggleWorld. Your job is to
figure out which idea of theirs is best.
For each idea, create a new class of Buggle that will be able to draw the checkerboard in that particular manner. Each class of Buggle should have the makeCheckerBoard method defined. You should try to implement the class using the least amount of code possible. "Code" is counted as the number of method calls in your extended Buggle class. As you create that many of the "super-Buggles" above, you may notice that many of them do some of the same things. That's because they're really all extensions of the CheckerBuggle. When it is useful to do so, you should put commonly used methods into a separate CheckerBuggle class and make the other Buggles extend this new class.
Restrictions: Every Buggle starts at (1,1). You can not use setPosition() or setHeading(). The checkerboard will be black and red. The first square (1,1) is black.
Hints: Try to look for patterns that repeat. Start with small patterns and build up in complexity. Patterns that are used repeatedly are good bets for abstracting into your own custom made methods.
Special Note: To make it easier to see your work, there is
a special method our Buggles will understand. It's contract is
public void rest ()
Buggle rests for an eighth of a second.
We will demonstrate how this method can help you in lab. You can not
use this method in your homework or anywhere else. Normal Buggles don't
understand how to take a break!
|
1) RowBuggle |
2) LBuggle |
|
3) SpiralBuggle |
4) MazeBuggle |
You can find the files to work with in the /usr/users/cs111/download directory on nike.wellesley.edu. Download the entire CS111Lab2 folder.