Skip to content

Commit

Permalink
Merge pull request #10 from Apoorva57/360-tree
Browse files Browse the repository at this point in the history
360 tree
  • Loading branch information
shreyamalogi authored Oct 17, 2024
2 parents f1e14bf + 09bd869 commit 984e2da
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 0 deletions.
Binary file added Turtle-a-thon/360-tree/360-tree.mp4
Binary file not shown.
14 changes: 14 additions & 0 deletions Turtle-a-thon/360-tree/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 360-Tree🌳

I've used turtle GUI 🐢 to make a 360-degree fractal tree. It comprises three layers and recursion has been used to implement the logic.

## Author 🎨

- **Apoorva**
- GitHub: [Apoorva57](https://github.com/Apoorva57) 👾✨

## Project Showcase 🚀

Take a look at the beautiful green 360-degree fractal tree with detailed branching.

https://github.com/user-attachments/assets/84123f07-088f-4cac-9490-e6543510fb52
192 changes: 192 additions & 0 deletions Turtle-a-thon/360-tree/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import turtle

t = turtle.Turtle()
t.speed(0)
turtle.bgcolor("black")
t.left(90)
t.speed(20)
def draw(l):
if (l < 10):
return
else:
t.pensize(4)
t.pencolor("peru")
t.forward(l)
t.left(30)
draw(3 * l / 4)
t.right(60)
draw(3 * l / 4)
t.left(30)
t.backward(l)
draw(20)
t.right(90)
def draw(l):
if (l < 10):
return
else:
t.pensize(4)
t.pencolor("saddle brown")
t.forward(l)
t.left(30)
draw(3 * l / 4)
t.right(60)
draw(3 * l / 4)
t.left(30)
t.backward(l)
draw(20)
t.left(270)
def draw(l):
if (l < 10):
return
else:
t.pensize(4)
t.pencolor("peru")
t.forward(l)
t.left(30)
draw(3 * l / 4)
t.right(60)
draw(3 * l / 4)
t.left(30)
t.backward(l)
draw(20)
t.right(90)
t.speed(2000)
def draw(l):
if (l < 10):
return
else:
t.pensize(4)
t.pencolor('saddle brown')
t.forward(l)
t.left(30)
draw(3 * l / 4)
t.right(60)
draw(3 * l / 4)
t.left(30)
t.backward(l)


draw(20)
def draw(l):
if (l < 10):
return
else:
t.pensize(3)
t.pencolor("light green")
t.forward(l)
t.left(30)
draw(4 * l / 5)
t.right(60)
draw(4 * l / 5)
t.left(30)
t.backward(l)
draw(40)
t.right(90)
def draw(l):
if (l < 10):
return
else:
t.pensize(3)
t.pencolor("sea green")
t.forward(l)
t.left(30)
draw(4 * l / 5)
t.right(60)
draw(4 * l / 5)
t.left(30)
t.backward(l)
draw(40)
t.left(270)
def draw(l):
if (l < 10):
return
else:
t.pensize(3)
t.pencolor("light green")
t.forward(l)
t.left(30)
draw(4 * l / 5)
t.right(60)
draw(4 * l / 5)
t.left(30)
t.backward(l)
draw(40)
t.right(90)
def draw(l):
if (l < 10):
return
else:
t.pensize(3)
t.pencolor('sea green')
t.forward(l)
t.left(30)
draw(4 * l / 5)
t.right(60)
draw(4 * l / 5)
t.left(30)
t.backward(l)
draw(40)
def draw(l):
if (l < 10):
return
else:
t.pensize(1)
t.pencolor("light green")
t.forward(l)
t.left(30)
draw(6 * l / 7)
t.right(60)
draw(6 * l / 7)
t.left(30)
t.backward(l)
draw(45)
t.right(90)
def draw(l):
if (l < 10):
return
else:
t.pensize(1)
t.pencolor("sea green")
t.forward(l)
t.left(30)
draw(6 * l / 7)
t.right(60)
draw(6 * l / 7)
t.left(30)
t.backward(l)
draw(45)
t.left(270)
def draw(l):
if (l < 10):
return
else:
t.pensize(1)
t.pencolor("light green")
t.forward(l)
t.left(30)
draw(6 * l / 7)
t.right(60)
draw(6 * l / 7)
t.left(30)
t.backward(l)
draw(45)
t.right(90)
# recursion
def draw(l):
if (l < 10):
return
else:
t.pensize(1)
t.pencolor('sea green')
t.forward(l)
t.left(30)
draw(6 * l / 7)
t.right(60)
draw(6 * l / 7)
t.left(30)
t.pensize(1)
t.backward(l)

draw(45)
t.hideturtle()
turtle.done()

0 comments on commit 984e2da

Please sign in to comment.