Skip to content

Instantly share code, notes, and snippets.

@PaulPolaschek
Created November 7, 2018 18:28
Show Gist options
  • Save PaulPolaschek/fab514c49c94c98e26e337315da9eb75 to your computer and use it in GitHub Desktop.
Save PaulPolaschek/fab514c49c94c98e26e337315da9eb75 to your computer and use it in GitHub Desktop.
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