
Often it is possible to create a number of shapes in a specific pattern algorithmically
(i.e., using a loop and calculating the position, size, velocity, etc.). When
combined with movement, this has the possibility of producing a very interesting
effect, with very little effort. In fact, this is the basis of most screen
savers, which, arguably, can be considered an
art form. While he did not use a computer, MC Escher used this principle to create incredible works of art.
In this project, you will create an environment that helps artists use mathematical expressions to generate pictures. Instead of simply building and evaluating expressions of numeric values like a standard calculator, you will allow the user to create expressions that evaluate to colors and then eventually to images. This may sound a little strange, but the results can be quite spectacular. Here is the general idea: an image is really a expression that maps points (x,y) to colors (r,g,b). This program simply evaluates that expression for each pixel (x-, y-point) in the image and stores resulting color.
For a work of art to be considered algorithmic art, its creation must include a process based on an algorithm devised by the artist. Here, an algorithm is simply a detailed recipe for the design and possibly execution of an artwork, which may include computer code, functions, expressions, or other input which ultimately determines the form the art will take. Unfortunately, it is not always easy to determine how the algorithm controls changing specific aspects of the image. This is where the software can help make it easy for the artist to develop an intuition how to generate and manipulate the resulting images by developing ways to parameterize these artistic algorithms.
Specification
Write an arithmetic interpreter that allows users to enter, change, combine, and evaluate arithmetic expressions interactively. A user of your program should be able to enter expressions interactively while your program keeps track of and evaluates them. Your program should save each expression entered as an Expression Tree so that it can be evaluated, combined, transformed, or printed whenever needed without requiring re-parsing the user's input.
Each time the user enters a complete expression by pressing return, it should be evaluated and the resulting image displayed for the user, then the user should be prompted to enter another. This is the so-called read-eval-print loop used in Scheme, Lisp, Smalltalk and other interpreted programming languages. The interpreter should ignore lines of input that are empty, i.e., contain only zero or more spaces and lines that begin with the comment character "#".
For this program, a color represents three real numbers, one each for the red, green and blue component, where the component values range from -1 to 1. For example, [-1,-1,-1] is black, [1,-1,-1] is red, and [1,1,-1] is yellow. During computation of an expression, the value of each component should not be restricted to this range, but the final result of the expression should be clamped to within the range -1 to 1. By default, like the colors, the domain of the image over X and Y is from -1 to 1. The upper left corner of the image will be (-1,-1) and the lower right corner will be (1, 1).
For example, here are several images generated from basic expressions.
Design Goals
This assignment provides a context to begin thinking about issues of design and coding style.- Making your code flexible. You will build this project in several steps, but you will not know the exact details of the next steps beforehand. Thus, you should try to structure your code so that later parts can be easily added on (i.e., you will find out for yourself if the code you designed really was flexible).
- Developing a clean coding style. Your code should adhere to modern coding standards, like those found in most serious coding shops throughout the country. This encompasses everything from formatting your code consistently to structuring your code in small, single-purpose, functions.
Unlike previous courses, where the main focus of projects was to write algorithms, in this project the algorithms will be relatively straightforward (and you will be given code to start).
Stages
This project will be released in stages. Part of the reason for this is to encourage you to think about code flexibility. For example, you can see that in each stage, you will be adding a different kinds of functions. If you structure you code in the first part to make it easy to add new kinds of functions, you will have an easier time on the later parts.- Part 1: get to know the given code, then refactor it to make adding new functions and language features easy
- Part 2: add interesting mathmatical functions and variables
- Part 3: add a wider variety of functions and animation
Two Kinds of Deadlines
Please look on the course calendar for the exact dates.
In this course, in contrast to previous courses, the focus of the course is going to be design rather than simply developing working code. As a result, there will be two kinds of deadlines: the "code complete" deadlines and the design deadlines.
Code Complete Deadlines
It's the expectation that students in this course are capable of programming smaller projects quickly. Therefore, quickly after a project is assigned (generally about 3 days later) we expect you to have code ready that meets the functionality requirements. If you have difficulty meeting these deadlines, it may be the case that your programming skills need to develop more before 108 is the right course to take. Please talk to Prof. Hewner if getting working code by the code complete date seems overwhelming.
You should do your best to design your well as you can by the code complete deadline. Follow the Design Guidelines. The better your code is by the code complete deadline, the less you should have to do.
Design Deadlines
After you get the code working, you we be assigned a TA to help you with the design. You'll need to quickly schedule a meeting to get feedback on your design. In the meeting, you TA will provide feedback on the areas that need improvement. You'll revise your design based on the feedback, and when you feel your design is right you'll submit again. Your TA will look at your code again, and either suggest a few small improvements via email or suggest an additional meeting if larger changes are necessary. You might go back and forth a few times. Eventually, your TA will be happy with your version and you can consider yourself Signed Off.
What if my Code is not Signed Off before the deadline?
Until your code is signed off, you cannot move on to the next part. So if your code is not signed of for part one by the deadline --- you will not be able to start Part 2 even though we will release the details. There is no direct grading penalty for getting signed off on Part 1, but the final deadline is the same for everyone, so getting behind can put you in a bad position. The best advice is to finish the implementation of each of the parts early, like within the first 2 or 3 days, then you will have plenty of time to get feedback from your TA and still get sign-off.
Please do not badger your assigned TA. Each time you submit to your assigned TA, it's expected that you make a good faith effort at a complete design. Do not submit partial designs to your TA for feedback. Be sure your design addresses all the points your TA brought up in the last email or meeting.
Grading
Grading for this assignment is simple, simply get all parts submitted and signed off on. As long as you start each of the parts early and are responsive to TA feedback, you should have no trouble getting full credit.| What you have submitted | Grade |
|---|---|
| Parts 1, 2, and 3 have been signed off on. | A |
| Parts 1 and 2 have been signed off on. Part 3 has been submitted and works, but there are still some style problems so your TA has not signed off. | A- |
| Parts 1 and 2 have been signed off on | B+ |
| Only Part 1 has been signed off on | C |
Resources
- Artificial Evolution for Computer Graphics by Karl Sims (the original paper and inspiration for this project)
- Manipulating Parameters for Algorithmic Image Generation by Mike King