Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page

C++ - Chaos Game


► Problem: In the chaos game, we begin with a square and place a point at one of the corners chosen at random. We then repeatedly choose a corner and plot the average of the previous point and the chosen corner.

Write a c++ program to implement the chaos game, use svg for output.


► Example Output:

Here is an example of the program's output when the current vertex cannot be chosen as the next iteration.