Chaos Game Examples

This page contains the code for some examples for the Chaos Game web app.

The examples on this page came in an email from a user of the app.

To view an example from this page: Copy the code from one of the white boxes on this page. Go to the Chaos Game page and click on the "Show Input/Export Dialog" button. In the dialog that pops up, Paste the code that you copied from this page into the text area. Then click the "Apply" button in the dialog. (See the info page, under "Saving Your Work," for more information about examples and using the Input/Export dialog.)

The bottom two bulit-in examples in the web app were taken from this page.


Hexaflake:

[

[ 0.161891, 0,
0.495224, 0,
0.161891, 0.333333 ],

[ 0.499522, 0,
0.832856, 0,
0.499522, 0.333333 ],

[ 0, 0.333333,
0.333333, 0.333333,
0, 0.666667 ],

[ 0.666667, 0.333333,
1, 0.333333,
0.666667, 0.666667 ],

[ 0.167144, 0.666667,
0.500478, 0.666667,
0.167144, 1 ],

[ 0.500478, 0.666667,
0.833811, 0.666667,
0.500478, 1 ],

[ 0.333333, 0.333333,
0.666667, 0.333333,
0.333333, 0.666667 ]

]

Sierpinski Tetrahedron:

[

[ -0.00573065, 0.0472779,
0.49427, 0.0472779,
-0.00573065, 0.547278 ],

[ 0.5, 0.0358166,
1, 0.0358166,
0.5, 0.535816 ],

[ 0.247135, 0.508596,
0.747135, 0.508596,
0.247135, 1.0086 ],

[ 0.241404, -0.00787965,
0.741404, -0.00787965,
0.241404, 0.49212 ]

]

Perfect Triangle:

[

[ 0.295127, 0.961172,
-0.207014, 0.459028,
0.79727, 0.459028 ],

[ 1.19272, 0.46424,
0.694842, 0.96212,
0.694842, -0.0336426 ]

]

Perfect Rectangle:

[

[ 0.295489, 1.00307,
0.295495, 0.296074,
1.00249, 1.00307 ],

[ 0.00384366, 0.702513,
0.0038431, -0.00326598,
0.709624, 0.702515 ]

]

Period-3 Sierpinski Triangle:

[

[ 0, 0,
0.333333, 0,
0, 0.333333 ],

[ 0.333333, 0,
0.666667, 0,
0.333333, 0.333333 ],

[ 0.666667, 0,
1, 0,
0.666667, 0.333333 ],

[ 0.169054, 0.334766,
0.502388, 0.334766,
0.169054, 0.668099 ],

[ 0.497612, 0.333333,
0.830946, 0.333333,
0.497612, 0.666667 ],

[ 0.333333, 0.666667,
0.666667, 0.666667,
0.333333, 1 ]

]

Warped Sierpinski Carpet:

[

[ -0.00191022, 0,
0.663801, 0,
-0.00191022, 0.333333 ],

[ 0, 0.336199,
0.333333, 0.336199,
0, 1.00048 ],

[ 0.666667, -0.00477555,
1, -0.00477555,
0.666667, 0.663801 ],

[ 0.336199, 0.666667,
1.00191, 0.666667,
0.336199, 1 ]

]

Spiral Hexagon:

[

[ 0.294377, 0.152157,
0.596428, 0.675325,
-0.221548, 0.450026 ],

[ 0.367413, 0.653607,
0.690493, 0.0940173,
0.917435, 0.971162 ]

]

Jerusalem Square:

[

[ 0.00101137, -0.000421295,
0.415894, -0.000421295,
0.00101137, 0.414461 ],

[ 0.588046, -0.00149603,
1.0015, -0.00149603,
0.588046, 0.411954 ],

[ 0.00379728, 0.586892,
0.415257, 0.586892,
0.00379728, 0.998352 ],

[ 0.585777, 0.581479,
1.00305, 0.581479,
0.585777, 0.998751 ],

[ 0.00262655, 0.416667,
0.169293, 0.416667,
0.00262655, 0.583333 ],

[ 0.83981, 0.413592,
1.00475, 0.413592,
0.83981, 0.578528 ],

[ 0.420097, 0.834136,
0.582769, 0.834136,
0.420097, 0.996805 ],

[ 0.419532, -0.00167144,
0.586199, -0.00167144,
0.419532, 0.164995 ]

]

Dragon Curve:

[

[ 0.253582, 0.0987185,
0.755723, 0.600862,
-0.248561, 0.600862 ],

[ 1.24716, 0.46424,
0.749284, 0.96212,
0.749284, -0.0336426 ]

]

Twin Dragon Curve, Type A:

[

[ 0.731369, 0.552152,
0.229226, 1.05429,
0.229226, 0.0500094 ],

[ 1.25003, 0.454211,
0.752149, 0.952091,
0.752149, -0.0436713 ]

]

Twin Dragon Curve, Type B:

[

[ -0.264322, 0.539256,
0.237822, 0.0371154,
0.237822, 1.0414 ],

[ 1.25433, 0.455644,
0.756447, 0.953524,
0.756447, -0.0422386 ]

]

Twin Dragon Curve, Type C:

[

[ 0.246419, 0.0428446,
0.74856, 0.544988,
-0.255724, 0.544988 ],

[ 0.747852, -0.0751846,
1.24574, 0.422692,
0.24997, 0.422692 ]

]

Twin Dragon Curve, Type D:

[

[ 0.280803, 0.0800939,
0.782944, 0.582237,
-0.22134, 0.582237 ],

[ 0.749283, 0.962115,
0.251403, 0.464239,
1.24717, 0.464239 ]

]

Reverse Blancmange Curve:

[

[ 0.5, 1,
0, 0.5,
0.5, 0.5 ],

[ 1, 0.5,
0.5, 1,
1, 0 ]

]

Spiral Tree:

[

[ 0, 0,
0.5, 0,
0, 0.5 ],

[ 0.5, 0,
1, 2.77556e-17,
0.5, 0.5 ],

[ 0.000716332, 1,
0.000716332, 0.5,
0.500716, 1 ]

]

Double Tree:

[

[ 0, 0,
0.5, 0,
0, 0.5 ],

[ 1, 0,
1, 0.5,
0.5, 2.77556e-17 ],

[ 0.000716332, 1,
0.000716332, 0.5,
0.500716, 1 ]

]

Box Tree:

[

[ 0.5, 0.5,
-1.66533e-16, 0.5,
0.5, 1.38778e-16 ],

[ 0.5, 0.5,
0.5, 0,
1, 0.5 ],

[ 0.494986, 0.5,
0.494986, 1,
-0.00501433, 0.5 ]

]

Shuriken:

[

[ 5.55112e-17, 0.5,
-8.32667e-17, 8.32667e-17,
0.5, 0.5 ],

[ 0.5, 2.77556e-17,
1, 0,
0.5, 0.5 ],

[ 0.494986, 1,
-0.00501417, 1,
0.494986, 0.5 ]

]

Tiling Tree:

[

[ 0, 0,
0.5, 0,
0, 0.5 ],

[ 1, 0,
1, 0.5,
0.5, 2.77556e-17 ],

[ -0.000716332, 1,
-0.000716332, 0.5,
0.499284, 1 ],

[ 0.499642, 0.499642,
0.749642, 0.499642,
0.499642, 0.749642 ]

]

Rings:

[

[ 0.5, 0.5,
-1.66533e-16, 0.5,
0.5, 1.38778e-16 ],

[ 0.5, 0.5,
0.5, -5.55112e-17,
1, 0.5 ],

[ 0.500716, 0.5,
0.500716, 1,
0.000716332, 0.5 ],

[ 0.664279, 0.667144,
0.997612, 0.667144,
0.664279, 1.00048 ]

]

Alternative C-Curve:

[

[ 0.769341, -0.0380334,
1.26926, 0.461894,
0.269415, 0.461894 ],

[ -0.264104, 0.468535,
0.234957, -0.0305268,
0.234957, 0.967598 ]

]