Chaos Game File Format

Chaos game files are text files that have the extension ".chg". Here is an example of a file with the code describing three chaos games.
Sierpinski Triangle { "Chaos Rules"
;Math Horizons, Nov. 2004
;Bob Devaney
  S  0.500000  0.000000  0.333333  0.000000  0.000000 
  S  0.500000  0.000000  0.333333  1.000000  0.000000 
  S  0.500000  0.000000  0.333333  0.500000  0.866025 
}

Fractal Starfish { "Chaos Rules"
;Math Horizons, Nov. 2004
;Bob Devaney
  S   0.200000  0.000000   0.041470  0.000000  1.000000 
  SR  0.961538  38.000000  0.958530  0.500000  0.500000 
}

Sierpinski Triangle 90 rotations { "Chaos Rules"
;Math Horizons, Nov. 2004
;Bob Devaney
  SR  0.500000  90.000000  0.333333  0.400000  0.200000 
  SR  0.500000  90.000000  0.333333  0.800000  0.400000 
  SR  0.500000  90.000000  0.333333  0.600000  0.800000 
}

The first line contains the name of the fractal followed by an opening bracket {. Anything after a semi-colon is treated as a comment and ignored as part of the code (although comments can be displayed from within IFS Exploration.) There can be up to 20 lines of comments, each of length less than 70 characters.

Following the comments (if any) are lines representing the chaos game moves. There should be 6 items on each line. The first is a string containing the four possible moves (S-scaling, R-rotation, H-horizontal reflection, and V-vertical reflection). Following this are the scaling factor, the rotation angle, the probability, and the coordinates of the fixed point. The numbers in each line should be separated by spaces, tabs, or commas. There can be at most 100 transformations in each IFS.

A closing bracket } on its own line will indicate the end of the IFS definition.

A file should contain at most 30 different iterated function systems.