Weights

A weight in range [0, 32767] may be attached to each rule. They are used when several rules are candidates in "RND", "LIN", "SUB" or "SUB1" grammars. A rule with weight <0> is inactive. The weight value is indicated between angle brackets, e.g. <43>. Default weight is <127>. It is convenient to use weights in range 0..127 so that they may be set by MIDI controllers, using parameters K1, K2... (see QuickStart §6).

Weights may be dynamically controlled: any rule may gain a positive or negative weight increment each time it is applied. For instance, a rule with weight <100-30> will have successive weights 100, 70, 40, 10 and 0, and therefore cannot be applied more than four times in the same production.

A good idea for checking a grammar is to set the weights of some rules to <1-1> (or <n-n> for any integer n). These rules can be used only one time. Once an item has been produced, produce a new one without resetting rule weights (the option is available by typing cmd-option space): the next item will be based on different rules since former ones have become inactive.

When using a subgrammar with dynamically decrementing weights, derivations of the work string stop when all candidate rules have weight <0>. This is a common way of avoiding endless derivations.

Changing weights dynamically on context-sensitive rules is a simple way to let patterns "emerge" randomly: some rules are becoming more active while they "inhibit" others.

Weights may be infinite. This is necessary when a rule should absolutely be applied as soon as it becomes a candidate. (BP2 actually selects the first candidate rule with an infinite weight) An infinite weight is notated "<∞>". On US keyboards, character '∞' is obtained by typing '5' with the 'option' key down.