# Assignment 6 Recursive Graphics Assignment - 8/14/2014...

• Homework Help
• 4

This preview shows page 1 - 3 out of 4 pages.

The preview shows page 1 - 3 out of 4 pages.
8/14/2014Recursive Graphics Assignment1/4COS 126Recursive GraphicsProgramming AssignmentWrite a program that plots a Sierpinski triangle, as illustrated below. Then, develop a program that plots a recursive pattern of your own design.Part 1.TheSierpinski triangleis another example of a fractal pattern like the H-tree pattern from Section 2.3 of the textbook. The Polish
8/14/2014Recursive Graphics Assignment2/4mathematician Wacław Sierpiński described the pattern in 1915, but it has appeared in Italian art since the 13th century. Though the Sierpinski trianglelooks complex, it can be generated with a short recursive program. Your task is to write a programSierpinski.javawith a recursive functionsierpinski()and amain()function that calls the recursive function once, and plots the result using standard drawing. Think recursively:sierpinski()should draw one filled equilateral triangle (pointed downwards) and then call itself recursively 3 times (with an appropriate stoppingcondition). When writing your program, exercise modular design: include a (non-recursive) functionfilledTriangle()that draws a filled equilateraltriangle of a specified size at a specified location.

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 4 pages?