The Sierpinski Triangle is rather beautiful. I thought might be interesting to try and create it in code. Luckily I was able to find many others who had attempted the same thing. I did a little reading on what was involved and the steps are pretty straight forward:
- Start with an equilateral triangle and locate the midpoints of each of the sides of the triangle.
- Connect each of the midpoints with a line segment, and remove the triangle you just created.
- You now have three equilateral triangles within the original equilateral triangle. Repeat steps 1 and 2 for each of these triangles. This process can be continued indefinitely or until you choose to stop.
Here's my attempt: