# Chaos Game Simulation - Fractals from randomness

Hello everyone,

So today I was without internet, and to use my free time I decided to program this little simulation called "Chaos Game". Although is very simple I find it very satisfying to watch and I hope that you do too.

Algorithm:

The algorithm is based in a video from Think Twice channel, here's the link:

but to describe it in a couple of words:

- Draw a polygon
- Draw a start point
- Pick a random vertex
- Create a new point halfway between the random vertex and the last point drawn.
- Repeat step 3 until enough number of points.

Controls:

- E -> Create new polygon point
- W -> Create start point
- R -> Reset polygon
- Space -> Start/Clear the simulation

Note on the setting "Can Repeat Vertex": This check button is to block from picking the same random vertex more than two times in a row when deciding the random vertex in step 3.

For example, if we have a triangle with vertices 1-2-3, we could have the next sequences:

- Can Repeat Vertex = true -> 1-1-2-3... (Vertex 1 is picked two times in a row)

- Can Repeat Vertex = false -> 1-2-3-1... (No vertex is picked two or plus times in a row)

This Boolean changes the result a lot, so I recommend to always try it on and off while searching for fractals.

Hope you learned something or at least you had fun hunting fractals.

Have a wonderful day and stay safe!

PD: My favorite is a 6 points hourglass like polygon without vertex repetition.

Status | Prototype |

Platforms | HTML5 |

Rating | Rated 4.0 out of 5 stars (1) |

Author | Oriol - Rough Skin |

## Leave a comment

Log in with itch.io to leave a comment.