-
Notifications
You must be signed in to change notification settings - Fork 0
/
zub.py
51 lines (45 loc) · 1.08 KB
/
zub.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
# -*- coding: utf8 -*-
# Soubor: zelva.py
# Datum: 13.12.2012 08:22
# Autor: Marek Nožka, nozka <@t> spseol <d.t> cz
# Licence: GNU/GPL
# Úloha: seznámení s želvou
############################################################################
import turtle as t
import random
def zub(kroky,hloubka):
if hloubka>random.randint(1,3):
zub(kroky/3.0, hloubka-1 )
else:
t.forward(kroky)
t.left(60)
if hloubka>random.randint(1,3):
zub(kroky/3.0, hloubka-1 )
else:
t.forward(kroky)
t.right(120)
if hloubka>random.randint(1,3):
zub(kroky/3.0, hloubka-1 )
else:
t.forward(kroky)
t.left(60)
if hloubka>random.randint(1,3):
zub(kroky/3.0, hloubka-1 )
else:
t.forward(kroky)
def zubbbb(kroky):
t.forward(kroky)
t.left(60)
t.forward(kroky)
t.right(120)
t.forward(kroky)
t.left(60)
t.forward(kroky)
############################################################################
t.speed(9)
t.up()
t.goto(-300,0)
t.down()
zub(200,5)
t.exitonclick()