Created
November 7, 2018 18:28
-
-
Save PaulPolaschek/fab514c49c94c98e26e337315da9eb75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
#rekursive tree | |
def branch(length=50, angle=30, factor=0.5, stops=2): | |
if length < 5: | |
return | |
turtle.fd(length) | |
turtle.left(angle) | |
branch(length * factor, angle) | |
turtle.right(angle) | |
branch(length * factor, angle) | |
turtle.right(angle) | |
branch(length * factor, angle) | |
turtle.left(angle) | |
turtle.fd(-length) | |
turtle.speed(0) | |
turtle.goto(0,-400) | |
turtle.clear() | |
turtle.left(90) | |
branch(300, 60, 0.75) | |
turtle.exitonclick() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment