BuggleWorld recursion

Applet demonstrating the desired behavior for this problem is available in the Test folder.

setPosition, setHeading, and setDirection are prohibited for this problem.

ConcentricRugWorld

Modify the file ConcentricRugWorld.java.
In this problem, a ConcentricBuggle works at the Concentric Rug company. The Concentric Rug company makes rugs with two alternating colors as illustrated below. A ConcentricBuggle has a recursive method makeRug which takes in two numbers indicating the width and height of the rug and two colors which indicate the two colors to alternate to draw the rug. Any strip of space of one cell width or height is left uncolored. After completing a rug, the ConcentricBuggle finishes back in its starting position, heading, and brush state. Its brush color will be the color of the innermost ring it colored. makeRug returns the number of rings the ConcentricBuggle painted.

You should not need to modify the run method. You can, if you wish, modify the run method to draw your rug in different colors than the default colors. To solve this problem, you will write methods for the ConcentricBuggle class. The skeleton for makeRug is provided below.

// This method draws a pattern of concentric squares starting with the first color
// and alternates the two colors given. The initial size (width and height) of the
// drawing space is provided.
// Any inner space of width or height of 1 cell is not colored in.
// This method meets the invariant that the buggle returns to its initial position,
// heading, and brush state after completing the method. The buggle is assumed to
// start with its brush up. The buggle's final color will the the last color it used.
// This method also returns the number of concentric rings the buggle painted.
public int makeRug(Color c1, Color c2, int width, int height) {
  // add your code here
}