import java.awt.*; /* CS111 Lab 2 Writing a Method Wendy Wellesley */ public class Checksboard extends BuggleWorld { int n=5; public void setup() { setDimensions(n,n); } // setup() // dude is a CheckerBuggle who invokes the method drawPattern() // 4 times in order to create a little checkerboard public void run () { CheckerBuggle dude = new CheckerBuggle(); dude.drawPattern(); dude.setColor(Color.blue); dude.drawPattern(); dude.setColor(Color.yellow); dude.drawPattern(); dude.setColor(Color.black); dude.drawPattern(); } // run() } // class Checksboard class CheckerBuggle extends Buggle { // draws one step pattern public void drawPattern () { this.brushUp(); this.forward(); this.brushDown(); this.forward(); this.brushUp(); this.left(); this.forward(); this.brushDown(); this.backward(); this.right(); this.brushUp(); this.forward(); this.brushDown(); this.forward(); this.left(); } // drawPattern() } // class CheckerBuggle