Context free weights

Let the developers know what you think of the software and what can be done to either improve the CFDG language or the Context Free program.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
guyomes
Posts: 2
Joined: Wed Apr 04, 2007 5:36 am

Context free weights

Post by guyomes »

Hi,

I'm new to context free art, and I just love it! Among the different features, I think there is one which could be added whithout breaking the context-free philosophy: that is the possibility of modifying the weights of a rule when we call it.

Now the weights are constant during all the drawing, while the position and color can be ajusted at each call. So a cool improvement would be the possibility of doing something like this:

Code: Select all

rule Shape 1 {
  SQUARE {}
  Shape {w 0.5 2}
}

rule Shape 1 {
  CIRCLE {}
  Shape {w 2 0.5}
}
In this example, the first time we call 'Shape {w 0.5 2}', the weight to call the first version of the rule is 0.5*1, and for the second it is 2*1. And if we call it again, it will become 0.5*0.5*1 and 2*2*1, and so on.

It seems also easy to implement by rembering the last weight vector along whith the matrix pultiplication.

What do you think of it?

guyomes
Posts: 2
Joined: Wed Apr 04, 2007 5:36 am

Post by guyomes »

Finally, instead of multiplying a weight by a number, it would be nicer to add the number to the weight, and mirroring when going out of bounds. This idea comes from Guigui in the topic Suggestion for the saturation and the brightness parameters, and I find it especially well suited for the weight adjustements. And instead of a single weight, we would give a interval of weight, which would give the bound. The center of the interval would be the initial weight. In this way, the probabilities would not always become trivial as it could easily have been the case with the multiplication of the weights presented above.

So a new example would be something like this:

Code: Select all

startshape Drunkvertical

//this is the first version of the rule; initial weight is 90
//its weight will be modified by the first number after w

rule Drunkvertical  0 180 {
  SQUARE {}
  Drunkvertical {y 1 r 1 s 0.99 w -1 1}
}

//the second version; initial weight is 90
//weight modified by the second number after w

rule Drunkvertical 0 180 {
  SQUARE {}
  Drunkvertical {y 1 r -1 s 0.99 w 1 -1}
}
Thus, while still beeing context free, it offers more liberty: in addition of specifying a geographical shift of the child shape, we could specify a shift of the intrisic nature of the child shape. And I find this very exciting!

Post Reply