我需要巴恩斯利蕨類植物的幫助。我沒有得到所有的葉子圖片,卻得到了錯誤的運行時間消息,當我跑我的代碼,我知道我很接近,但需要一些幫助巴恩斯利蕨類植物蟒蛇語
#! /usr/bin/env python
import matplotlib.pyplot as plt
import random
# starting values
x = 0.5
y = 0.0
for i in range(10000):
rand = (random.randrange(0,1))
if (rand < 0.02):
x = 0.5
y = 0.27*y
if ((0.02 <= rand) and (rand <= 0.17)):
x = -0.139*x + 0.263*y + 0.57
y = 0.246*x + 0.224*y - 0.036
if ((0.17 < rand) and (rand <= 0.3)):
x = 0.17*x - 0.215*y + 0.408
y = 0.222*x + 0.176*y + 0.0893
if ((0.3 < rand) and (rand < 1.0)):
x = 0.781*x + 0.034*y + 0.1075
y = -0.032*x +0.739*y + 0.27
plt.plot(x,y,'.')
plt.show()