This is an interactive demonstration of the dynamical system called Chaos game. This game is "played" by following rules:

- Fix polygon
`Π` - Pick a random point
`P`_{0} - Choose a random vertex
`V`of the`Π` - Set
`P`_{n+1}to the midpoint of the segment`P`_{n}`V`[Note that the midpoint of the`P`_{n}`V`has coordinates`λ`⋅(`P`_{n}+`V`), where`λ`= 0.5] - Go back to step 3 and repeat

By repeating steps 3 and 4, you will get a set of points {`P`_{0}, `P`_{1}, `P`_{2}, ...} which is called *orbit*.
What is interesting about this game, is that no matter what point you pick in the second step, you will get "the same" picture after enough iterations.

In this demonstration, all points are treated as complex numbers.
Also, the parameter `λ` is a complex number.
By varying the parameter `λ` we can get more interesting pictures.

Control vertices of the polygon and value `λ` by dragging dots.
Change the number of vertices with input at the bottom of screen.

If the *Color* option is selected, a point will be colored by the color of the vertex that was selected for that iteration.