# Recursive Graphics

We'll be implementing the Sierpinski triangle assignment described at http://www.cs.princeton.edu/courses/archive/fall13/cos126/assignments/sierpinski.html.

Some notes:

• You should create a Sierpinski class that derives from `sf::Drawable`. Then, you can have it just `draw` itself to your main window. If you are familiar with Java, this would be called “implementing the `Drawable` interface”:
```// instantiate
Sierpinski st(7); // parameter is recursion depth
// maybe want to give it a size parameter too

...

// later, in the main draw loop
window.draw(st);
```
• Review Jon's LineSegment example to see a simple example of how to do this: Attach:LineDemo.tar.gz.
• Using SFML's ConvexShape class is a good way to draw a filled triangle.
• Follow the process advice from the Princeton assignment: “First, make sure that your program draws a single filled equilateral triangle when N equals 1. Then, check that it draws four filled equilateral triangles when N equals 2. Your program will be nearly (or completely) debugged when you get to this point.”
• Your executable must read two parameters (integers): recursion-depth and window-size. You should create a square SFML window that's exactly as big as the window-size argument, and your triangle should fill it.

### What to turn in

It's important that you turn in everything needed to build your projects.

Please note that you will have two projects for this assignment: (1) the Sierpinski implementation and (2) your own original work.

Create a directory with all your work and with both projects in the same directory.

Your `Makefile` should build both projects. The two resulting executables should be named `sierpinski` and `original`. Use unique names for the files in the two projects, so you can put all the files in the same directory.

Each of the two executables should take two arguments:

1. Recursion depth
2. Initial window height

Your `Makefile` should contain two targets: `all` and `clean`. The former should build both executables, and the latter should remove the executables, `.o` files, and all other temporary files created during the build.

The directory should be named ps1 and contain:

1. Your `Makefile`
2. `.cpp` and `.hpp` files for both projects
3. Any images and fonts you are using
4. Anything else needed to build and run your code
5. Screenshots of program output for both projects:
6. A `readme.txt` file that includes:
• A discussion of what you did—at least 100 words. What you actually implemented, and, what was interesting, hard, fun, or easy about your project
• An analysis of how much memory each of the programs uses, depending on the recursion depth:
• For the data structures (if any)
• During draw operation (including number of stack frames)
• How much time you invested (optional)
• Anything else you'd like us to know (optional)

Remember, we will have to build and run your code, so make sure to submit all that's needed!

Use `tar` command from the parent directory of your `ps1`:

``` tar czvf <archive-file-name>.tar.gz ps1
```

### How to turn it in

Submit as follows:
 Feature Value Comment Sierpinski implementation 10 full & correct implementation 1 pt file name correct 1 pt reads depth and window-size args 4 pt draws triangles properly 4 pt implements draw function as derived class of `sf::Drawable` original graphic project 8 full implementation 1 pt file name correct 1 pt reads depth and window-size args 2 pt is somewhat different from Sierpinski project 2 pt implements draw function as derived class of `sf::Drawable` 2 pt screenshot and explanation is posted to course discussion group Makefile 6 full & correct implementation 1 pt builds objects associated with sierpinski project 1 pt links "sierpinski" executable 1 pt builds objects associated with original project 1 pt links "original" executable 1 pt "make all" builds everything 1 pt "make clean" removes temporary files, objects, and executables tar.gz archive 2 all files packaged in .tar.gz file with correct directory structure readme.txt 4 complete and discusses work Total 30