The Chaos Game defines a set of attractors and an iterative process that moves a point towards a random attractor by a specified magnitude.

This image is generated by having five attactors, the points of a pentagon. At each iteration the current point moves towards a point on the pentagon by PHI (0.618) times the distance to the attractor.



I wanted to see what would happen if the magnitude of attraction was also chaotic. At each stage of the algorithm a random attraction magnitude is chosen between [0.5,1.5].



More Resources:

Mathworld Chaos Game Page

Wikipedia Chaos Game Page

[Update] Processing code to generate the shapes above:



var attractors = [];

var current = [random(800),random(800)]

for(var i = 0; i < 6; i++){

attractors.push([cos(i * 2 * PI/5) * 300, sin(i * 2 * PI/5) * 300]);

}

var attraction = 0.5;

void draw(){

translate(width/2, height/2);

rotate(PI/2);

stroke(0);

for(var i = 0; i < attractors.length; i++){

rect(attractors[0], attractors[1], 5,5);

}

for(var i = 0; i < 100; i++){

point(current[0],current[1]);

var target = attractors[Math.floor(Math.random() * (attractors.length-1))]

current[0] = current[0] - (current[0] - target[0]) * attraction;

current[1] = current[1] - (current[1] - target[1]) * attraction;

}

attraction = Math.random()+.5;

}

