...

/

The Sierpinski gasket

The Sierpinski gasket

We'll cover the following...

So far, the examples of recursion that we've seen require you to make one recursive call each time. But sometimes you need to make multiple recursive calls. Here's a good example, a mathematical construct that is a fractal known as a Sierpinski gasket:

widget

As you can see, it's a collection of little squares drawn in a particular pattern within a square region. Here's how to draw it. Start with the full square region, and divide it into four sections like so:

widget

Take the three squares with an ×\times ...