Kevin's Blog

Tuesday, July 05, 2005

Chris Coyne.com CFDG - Context Free Design Grammar


CFDG is a very simple programming language I made for generating pictures. You write a text file as an input (a .cfdg file), and it spits out a graphic (usually a .png file).

Your text file consists of 3 things:

1. a startshape; this is just the name of an object you make up
2. rules for growth; you can replace any object with any other objects, at relative positions, orientations, and sizes. (And now: brightnesses.)
3. circles and squares; they are special objects and they are drawn rather than replaced.

You can have conflicting rules. When this happens, CFDG picks one randomly. YOu can also specify weightings for which rules you'd like to have chosen more often.

And finally, infinite loops are okay, as long as the shapes get infinitely small.

What follows are some .cfdg files and the images they generated. "


Check out this sample image.