Skip to content

Commit 0563de1

Browse files
author
Jakub Klinkovský
committed
major restructurization - created library with default configs and actions
1 parent cb774dd commit 0563de1

19 files changed

Lines changed: 119 additions & 143 deletions

arrowhead_curve.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

caesaro_fractal.py

Lines changed: 0 additions & 29 deletions
This file was deleted.
File renamed without changes.

fractals/_lib.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
import builtins
4+
import turtle as t
5+
6+
builtins.iteration = 6
7+
builtins.position = (-300, -300)
8+
builtins.heading = 0
9+
builtins.size = 600
10+
builtins.pencolor = "black"
11+
builtins.fillcolor = "black"
12+
13+
def init():
14+
t.speed(0)
15+
t.tracer(600, 0)
16+
t.hideturtle()
17+
t.pencolor(pencolor)
18+
t.fillcolor(fillcolor)
19+
t.penup()
20+
t.setpos(position)
21+
t.setheading(heading)
22+
t.pendown()
23+
24+
def exit():
25+
t.update()
26+
t.exitonclick()

fractals/arrowhead_curve.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
import builtins
4+
import turtle as t
5+
6+
import _lib
7+
8+
builtins.position = (-300, -240)
9+
10+
def arrowhead_curve(iteration, size, direction=1):
11+
if iteration == 0:
12+
t.forward(size)
13+
14+
else:
15+
t.left(60 * direction)
16+
arrowhead_curve(iteration-1, size/2, -direction)
17+
t.right(60 * direction)
18+
arrowhead_curve(iteration-1, size/2, direction)
19+
t.right(60 * direction)
20+
arrowhead_curve(iteration-1, size/2, -direction)
21+
t.left(60 * direction)
22+
23+
if __name__ == "__main__":
24+
_lib.init()
25+
arrowhead_curve(iteration, size)
26+
_lib.exit()

fractals/caesaro_fractal.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python
2+
3+
import builtins
4+
import turtle as t
5+
6+
import _lib
7+
from koch_curve import koch_curve
8+
9+
10+
def caesaro(iteration, size):
11+
for i in range(4):
12+
koch_curve(iteration, size, 85)
13+
t.left(90)
14+
15+
if __name__ == "__main__":
16+
_lib.init()
17+
caesaro(iteration, size)
18+
_lib.exit()

fractals/koch_antisnowflake.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
3+
import builtins
4+
import turtle as t
5+
6+
import _lib
7+
from koch_curve import koch_curve
8+
9+
builtins.position = (-300, 250)
10+
11+
def koch_antisnowflake(level, size):
12+
for i in range(3):
13+
koch_curve(level, size, direction=-1)
14+
t.right(120)
15+
16+
if __name__ == "__main__":
17+
_lib.init()
18+
koch_antisnowflake(iteration, size)
19+
_lib.exit()

0 commit comments

Comments
 (0)