# 2. Sierpinski (30 points). The Sierpinski triangle is an example of a.docx

• Homework Help
• ebenezerp782
• 4

This preview shows page 1 - 3 out of 4 pages. 2. Sierpinski (30 points). The Sierpinski triangle is an example of a fractal pattern like the H-tree patter from Section 2.3 of the textbook. 42 order 1 order 2 order 3 order 4 order 5 order 6 The Polish mathematician Waclaw Sierpiskidescribed 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 Sierpinski triangle of order n to standard drawing. Think recursively: sierpinski() should drawone filled equilateral triangle (pointed downwards) and then call itself recursively three times (with an appropriate stopping condition). It should draw 1 filled triangle for n = 1;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 API:
• • • 