Sierpinski carpet algorithm