Skip to content

Commit a8852ab

Browse files
Merge pull request #1383 from asunder123/fence
Fence
2 parents 00c39a0 + 61d91c5 commit a8852ab

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed
Binary file not shown.

Recursion Visulaizer/Meshimproved.PNG

275 KB
Loading

Recursion Visulaizer/fencedmesh.PNG

329 KB
Loading

Recursion Visulaizer/git

Whitespace-only changes.
Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,67 @@
11
import turtle
2+
import random
23
t = turtle.Turtle()
3-
t.left(90)
4-
t.speed(200)
4+
num=random.randint(1,1000)
5+
t.right(num)
6+
t.speed(num)
7+
t.left(num)
58

69
def tree(i):
710
if i<10:
811
return
912
else:
10-
t.forward(i)
11-
t.left(30)
13+
t.right(15)
14+
t.forward(15)
15+
t.left(20)
16+
t.backward(20)
17+
tree(2*i/5)
18+
t.left(2)
1219
tree(3*i/4)
13-
t.right(60)
20+
t.left(2)
21+
tree(i/2)
22+
t.backward(num/5)
23+
tree(random.randint(1,100))
24+
tree(random.randint(1,num))
25+
tree(random.randint(1,num/2))
26+
tree(random.randint(1,num/3))
27+
tree(random.randint(1,num/2))
28+
tree(random.randint(1,num))
29+
tree(random.randint(1,100))
30+
t.forward(num/5)
31+
t.right(2)
1432
tree(3*i/4)
15-
t.left(30)
16-
t.backward(i)
33+
t.right(2)
34+
tree(2*i/5)
35+
t.right(2)
36+
t.left(10)
37+
t.backward(10)
38+
t.right(15)
39+
t.forward(15)
40+
print('tree execution complete')
1741

18-
tree(100)
42+
def cycle(i):
43+
if i<10:
44+
return
45+
else:
46+
try:
47+
tree(random.randint(1,i))
48+
tree(random.randint(1,i*2))
49+
except:
50+
print('An exception occured')
51+
else:
52+
print('No Exception occured')
53+
print('cycle loop complete')
54+
55+
def fractal(i):
56+
if i<10:
57+
return
58+
else:
59+
cycle(random.randint(1,i+1))
60+
cycle(random.randint(1,i))
61+
cycle(random.randint(1,i-1))
62+
cycle(random.randint(1,i-2))
63+
print('fractal execution complete')
64+
65+
fractal(random.randint(1,200))
66+
print('Execution complete')
1967
turtle.done()

0 commit comments

Comments
 (0)