LPy-project/populus_nigra_italica.lpy

30 lines
803 B
Plaintext
Raw Permalink Normal View History

2019-05-09 13:39:36 +02:00
import random
a = 50
2019-05-09 12:08:10 +02:00
def Start():
#random.seed(150)
pass
2019-05-09 13:39:36 +02:00
Axiom: _(0.3)@GsG(0.5)A(1,1.0)
derivation length: 50
2019-05-09 12:08:10 +02:00
production:
2019-05-09 13:39:36 +02:00
A(x,k) :
if x >= a-20:
produce [-(a-x)F(1,0.05+0.25/k)C(1,k)]/(75)F(0.7,0.05+0.25/k)A(x+1,k+0.1)
2019-05-09 13:45:28 +02:00
elif x <= 5:
produce F(0.7,0.05+0.25/k)A(x+1,k+0.1)
2019-05-09 13:39:36 +02:00
else:
produce[-(30)F(1,0.05+0.25/k)B(1,k)]/(75)F(0.5,0.05+0.25/k)A(x+1,k+0.1)
B(x,k):
if x <= 5:
r1 = random.random()
r2 = random.random()
produce [^(r1*50)F(1,0.05+0.25/k)-(20);Leaf(1)][&(r2*50)F(1,0.05+0.25/k)-(20);Leaf(1)]F(1,0.05+0.25/k)[-(20);Leaf(1)]B(x+1,k+1)
2019-05-09 13:39:36 +02:00
C(x,k):
2019-05-09 12:44:23 +02:00
if x <= 5:
2019-05-09 13:39:36 +02:00
r1 = random.random()
r2 = random.random()
produce [^(r1*50)F(1,0.05+0.25/k)-(20);Leaf(1)]F(1,0.05+0.25/k)[-(20);Leaf(1)]C(x+1,k+1)
2019-05-09 12:08:10 +02:00
Leaf(x):
produce ~l(1)
interpretation:
endlsystem