CSE 131 Module 6: Recursion

Extensions

Extension 1: Divine Lines (5 points):

Authors
A video demonstrating a solution can be found here.
In the extensions source folder, find and open the lines package and the Lines class contained therein. The main method is provided, and it calls the method drawLine,which you must complete.
Do not change the parameters or return type of the drawLine method! You are welcome to define other methods in the Lines class if you wish, but the drawLine method's signature (the number and types of its parameters and its return type) must be preserved as you do your work.

Your task is to devise an algorithm for drawing a line from (x1,y1) to (x2,y2) using recursion. It may take you some time to think about how to do that, but once you see the recursive nature of drawing a line, you will probably need only a few lines of code to accomplish this task.

Please take note of the following guidelines, as you will not receive credit unless your solution follows the rules of this assignment:

When you are done it should look like this:

When you done with this extension, you must be cleared by the TA to receive credit.

This demo box is for extension 6.1
Last name WUSTL Key Propagate?
(or your numeric ID) Do not propagate
e.g. Smith j.smith
1 Copy from 1 to all others
2 Copy from 2 to all others

TA: Password:

End of extension 1


Extension 2: Persian Recursian (10 points):

Authors
In the extensions folder open the recursivepatterns package and the PersianRug class. Your task is to complete the method persianRug so that it draws a rug similar to the one shown below:
Each call to persianRug works on a given square of the rug. Consider the picture shown below:

The parameters for persianRug are documented in the source code provided to you for this extension.

Notes: