Assignment functions and Recursion 2. Sierpinski (30 points). The Sie.docx

• Homework Help
• 5

This preview shows page 1 - 3 out of 5 pages. Assignment functions and Recursion 2. Sierpinski (30 points). The Sierpinski triangle is an example of a fractal pattern like the H tree pattern from Section 23 of the textbook order 1 order 2 order 3 onders The Polish mathematician Waclaw Sierpirski described the pattern in 1915, but it has appeared in Italian art since the 13th century.Though the Sierpinski triangle looks complex, it can be generated with a short recursive function. Your main task is to write a recursive function sierpinski that plots a Sierpinskitriangle of order n to standard drawing. Think recursively: sierpinski should draw one filled equilateral triangle (pointeddownwards) and then call itself recursively three times (with an appropriate stopping condition). It should draw 1 filled triangle for not 4 filled triangles for n = 2: and 13 filled triangles for n=3, and so forth." API specification. When writing your program, exercise modular design by organizing it into four functions, as specified in the following APE publie elass Sierpinski 1/ Height of an equilateral triangle whose sides are of the specified length publle statie double height (double length) // Draws a filled equilateral triangle whose bottom vertex is (x, y) // of the specified side length.
• • • 