|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Basic syntax CFDG programs consist of one or more rule definitions and [optional] initial assignments: parameter1 = initial_value1 parameter2 = initial_value2 ... startshape initial_rule_name rule rule_1 { rule_A { parameter1 value1 parameter2 value2 ... } rule_B { parameter1 value1 parameter2 value2 ... } ... } rule rule_2 { ... } ...Rules define a set of instructions, i.e. calls to other rules and/or built-in routines, such as CIRCLE. They may be called with optional parameters enclosed in { } or ( ) that define changes in size, color, shift or rotation (listed in this table).
Their initial values may be changed by assignments before rules' definitions. The following built-in rules are available: CIRCLE : filled circle;
SQUARE : filled square;
RECT : empty square;
LINE : line segment.
Multiple versions of each rule are supported. In this case CFDG will pick a random version. You may optionally specify weightings (probabilities) for each rule's version (see below). Script execution starts with initial rule (start shape), defined with startshape rule_name .
Keywords, rules' names and parameters are case-insensitive, e.g. startshape First means the same as STARTSHAPE FIRST .
Parameters may be contracted to their first letter, e.g. Foo {s 2} is the same as Foo {size 2} .
Line breaks, spaces and tabs are allowed throughout the code. Spaces are mandatory only between parameters and their values, e.g.: Foo { x2 } //this is an error .
Comments begin with // to the end of the line, e.g. SQUARE {r 30} //draws a square rotated by 30 degrees .
Advanced features (under construction) Parameter N limits the recursion level.
If it takes too long to generate your image, try to reduce this parameter or simplify your script. Infinite loops are okay, as long as the shapes get infinitely small. You may specify the weighting (probability) for any rule version. Put the weighting (0 to 1) after the rule name, e.g. rule Branch 0.25 {...} //will be selected approximately in 1/4 of cases .
By default all rules have equal weightings. Example 2. (to be continued...) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following table lists all supported parameters and their possible values.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Notes (under construction) |