Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

How to Generate the Sierpinski Triangle [6/10]

6. Increasing the Depth of the Sierpinski Triangle

The number of levels of the Sierpinski triangle is now increased to 6, by the last argument of the call to the user-defined function SierpinskiTriangle. It is an increase by two compared to the image produced by the previous page.
[Run the program]

The color of the Sierpinski triangle has been changed to periwinkle. Also, there is no more need to visualize, in three colors, the three vertices p1 , p2 , p3 of the big triangle, so the drawing statements have been removed compared to the previous page.
[Run the program]

If you like this tutorial, you can use the gray sharing buttons to share it with your friends. The sharing buttons create a link to the current page. The buttons for Twitter, Facebook, Pinterest, Reddit and LinkedIn are provided.

On the next page, the selection of colors is made easier.

Loading...