Fractal?

A fractal is a curve or geometrical figure, which is based on a recurring pattern that repeats itself indefinitely at progressively smaller scales. Fractals are useful in modelling some structures (such as snowflakes), and in describing partly random or chaotic phenomena such as crystal growth and galaxy formation.

Find out more about fractals: http://en.wikipedia.org/wiki/Fractal

In this challenge we will be looking at two well-known fractals both named after the Polish mathematician Wacław Sierpiński:

Sierpiński Triangle

Sierpiński Carpet

Sierpiński Triangle

The following figures show how the pattern of this fractal:





Your Challenge: Sierpiński Carpet

The following figures show how the pattern of this fractal:



Your challenge consists of recreating this fractal by completing the following code:

