More code to play with on the fractal tree problem. It does one run in black, then changes to magenta,
then cyan, and goes backward in green!!
from turtle import*
goto(0, -100)
pensize(2)
speed(1)
left(90)
def branch(branch_len):
if branch_len>10:
color('black')
angle=30
forward(branch_len)
left(angle)
color('magenta')
branch(branch_len*0.7)
right(angle*2)
color('cyan')
branch(branch_len * 0.7)
left(angle)
color('green')
backward(branch_len)
branch(100)
No comments:
Post a Comment