Recursive Art
Doing anything recursively requires you to think about the problem as made up of smaller versions of the same problem. Then your task is to determine what extra work would need to be done if the smaller version of the problem has already been completed. Additionally, you need to figure when the smaller problem has a trivial implementation (i.e., drawing one square or doing nothing) — this case halts the recursion. Drawing pictures recursively is a good way to to visualize the recursive process and an elegant way to create complex and interesting pictures.
Using Python's turtle module, create a drawing that contains one or more recursive elements. Write a function named drawEverything
that takes a single int
as a parameter representing the depth at which the recursion should stop (note, you may have additional criteria to stop the recursion as in the provided example that use either depth or length of the tree). This function will most likely not be recursive but, instead, set up one or more calls to your recursive function.
To get started, download this code using Ambient's snarf tool.
Submission
Create a README file that also includes your answers to the following questions about your artwork:
- What is your base case?
- What is your general case?
- Within your general case, what is your reduction step?
- What is the title of your art work?
- Briefly describe why you chose that title.
Submit your entire PyDev project electronically from within Eclipse or on the web to the assignment name 06_art.
Contest
For this optional bonus assignment you can compete in a Recursive Art Contest. We will have an Instructor's and Student's Choice winner in a variety of categories (such as most creative, most technically complex, most artistic, and most realistic). The Instructor's Choice will be chosen by the course staff, while the Student's Choice will be chosen by you. Winners will receive extra extra credit.
Judging will be based on
- Originality
- Aesthetic appeal
- Simplicity of the programs (the simpler the better, all things being equal)
Entries without a README file or a properly named module will not be considered for the contest (but can still receive the bonus points for the assignment).
Examples
Iterations of a Koch Snowflake Fractal |
Iterations of a Dragon Curve Fractal |
Recursively Smaller Line Webs |
Recursively Smaller Flower Shapes |
Chopsticks |
Snow Family |
Here are some more examples from students at Princeton working on a similar assignment.