Chaos game

From Rosetta Code
Revision as of 13:22, 1 March 2016 by rosettacode>Fwend (Created Chaos game draft task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Chaos game is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The Chaos Game is a method of generating the attractor of an iterated function system (IFS). One of the best-known and simplest examples creates a fractal, using a polygon and an initial point selected at random.

The task: play the Chaos Game using the corners of an equilateral triangle as the reference points. Add a starting point at random. Then add the next point halfway the starting point and one of the three corner points of the triangle. This corner point is chosen at random.

After a sufficient number of iterations, the image of a Sierpinski Triangle should emerge.