File: simplefractaltree.py

package info (click to toggle)
minetest-mod-pycraft 0.22-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,744 kB
  • sloc: python: 79,282; makefile: 10
file content (25 lines) | stat: -rwxr-xr-x 343 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# Code under the MIT license by Alexander Pruss
#

from turtle import *

def tree(depth):
    t.up(30)
    t.go(20)
    if depth > 1:
       tree(depth-1)
    t.back(20)
    t.down(60)
    t.go(20)
    if depth > 1:
       tree(depth-1)
    t.back(20)
    t.up(30)

t = Turtle()
t.follow()
t.verticalangle(90)
t.pendelay(0)
t.go(20)
tree(5)