Aging of flowers, and fruit formation
Open FlowerAging.gsz.
As you know flowers do not stay on the plant for a long time after blooming; in fact, they perish rather quickly and are dropped altogether or are replaced by a growing fruit after successful pollination. In our model, we can very simply introduce aging and dropping of flowers. First, the Flower requires two new parameters, age
and max_age
(L. 20):
module Flower(int age, int max_age) ==> //insert two new parameters for Flower RU(180) Cone(0.3, 0.3).(setShader(internodemat)) ...
When the Flower is introduced in the run
method for the first time it is initiated like this:
Bud(r, p, o), (r == 10) ==> RV(-0.1) Internode(0.05, 1) RV(-0.1) Internode(0.05, 1) Flower(1, irandom(10, 15)); ...
The initial age is thus 1, whereas the maximum age that the flower can attain is between 10 and 15 days, as determined by this command, irandom(10, 15)
, which will draw a number between 10 and 15, with equal probability.
As long as age has not attained max_age, it is incremented by one, i.e. the flower ages:
//increment flower age as long as max age is not reached: Flower(t, m), (t<m) ==> Flower(t+1, m);
When age is equal to max_age the flower is dropped:
//shed flower when max age is reached: Flower(t,m), (t>=m) ==> ;
Next, we could let the flower be transformed into a fruit (module already declared), with a certain probability, instead of letting it die: In order for this to work you need to write instead of
//shed flower when max age is reached: Flower(t,m), (t>=m) ==> ;
this:
//shed flower when max age is reached: //Flower(t,m), (t>=m) ==> ; Flower(t,m), (t>=m) ==> if(probability(0.5)) (Fruit) ;
Task: Introduce leaf shedding after 20 steps!