 ## Part 1 Complete the sketch that draws Julia Sets

• In class we will see how to use createGraphics() and copy() to store the canvas and redisplay it. You will need this in order to make your sketch run smoothly. This is a requirement.
• Modify the coloring as follows:
• All points that do not escape should be the same color
• All points that escape should be colored based on the number of steps it takes for them to escape. There are many ways to do this. Pick one that you like. The important part is to make it easy to notice the change in colors. Experiment until the results are pleasing.
• Note: it could help to modify your escapes(x) function so that instead of returning true/false, it returns the number of iterations it took to escape.
• When the mouse is pressed, use the complex number where it was pressed as the new C value for your Julia Set, and then redraw it using this new C value.
When the mouse moves around the sketch, show the orbit of the seed. Use lines to connect the points in the orbit. Allow this feature to be toggled on/off using the spacebar.
• Add a slider for controlling the bailout value. Set reasonable ranges on the slider. Whenever the slider is changed, you should redraw the Julia set using the new bailout.
• Julia sets are drawn using the function `f(x) = x^2 + C`. Modify your code so that pressing the right arrow increases the exponent of x by 1 (up to some reasonable limit), and pressing the left arrow decreases the exponent of x by 1. Don’t allow the exponent to go below 1.
• Add text to the sketch to display on the sketch:
• The iterated function that is being displayed. For example, if the exponent is 3 and the C value is (-0.2, -0.6), then display `f(x) = x^3 + -0.2 + -0.6i`.
• The current bailout value.
• Verify that your code runs without any error messages. A minimum 10-point deduction will be made if error messages are displayed in the console, even if all other requirements are met.

## Part 2 Create a new sketch that draws the Mandelbrot set

• Use the same f(x) and escapes(x) and Complex class that you used for the Julia Set sketch. The f(x) should be the version that allows for different exponents (as you did in the Julia Set above).
• The Mandelbrot set uses the same function `f(x) = x^2 + C`, but it answers a different question.
• The Julia Set answers the question: “Given this complex C value, which seeds escape, and which don’t?”. So, when you color a Julia Set sketch, you are interpreting each pixel as a different seed.
• The Mandelbrot Set answers the question: “Which C values cause 0 to escape?” So, when you color the Mandlebrot Set sketch, you are interpreting each pixel as a different C, and then asking if 0 escapes.
• Color the sketch as you did above for the Julia set, so that the color is based on the “escape time” (the number of steps needed for it to escape).
• As in the Julia set, use the right and left arrow keys to control the exponent in the function f(x).
• You do not need to show orbits or display any text on the sketch.