Sierpinski Triangle (pixel-by-pixel)

Fallback content, in case the browser does not support Canvas.

Pixels plotted:

To make this image, follow this very simple algorithm...

  1. Take three vertexes of a triangle.
  2. Now take any random point inside the triangle. Use it as a starting point.
  3. Plot this point.
  4. Now choose any of the 3 vertexes at random and find the midpoint between your current position and this vertex.
  5. Go to step 3. Repeat.

What happens when you follow the same algorithm but with a square instead of a triangle?