Sunday, February 1, 2009

Limitless Squares

This is yet another example of the power of iterative code. The canvas is divided into four equal square areas. Each of which contains either a Square (with a circle inset) or is further divided into four equal squares. And this continues ...

The code is:

startshape A

rule A 100 {
A { s 0.5 x 0.25 y 0.25 }
A { s 0.5 x -0.25 y -0.25 }
A { s 0.5 x -0.25 y 0.25 }
A { s 0.5 x 0.25 y -0.25 }
}

rule A 50 {
B {}
}

rule B {
SQUARE {}
SQUARE {s 0.9 b 1}
CIRCLE { s 0.2 hue 60 sat 1 b 0.9 }
}

rule B {
SQUARE {}
SQUARE {s 0.9 hue 60 sat 1 b 0.9 }
CIRCLE { s 0.2 b 1}
}

The same code generates another variation of the image.

No comments:

Post a Comment