Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
helenehmoe authored Nov 2, 2022
1 parent f86dee1 commit 083dcca
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
46 changes: 46 additions & 0 deletions forrest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from turtle import *
from random import *

ts = Screen()
ts.screensize(canvwidth=595, canvheight=842, bg="light blue")

t1 = Turtle()
t2 = Turtle()
t3 = Turtle()
t4 = Turtle()

turtles = [t1, t2, t3, t4]


def branch(t, branch_length):
angle = randint(22, 30)
sf = uniform(0.6, 0.8)
size = int(branch_length / 10)
t.pensize(size)
if branch_length < 20:
t.color('green')
t.stamp()
t.color('brown')
if branch_length > 10:
t.forward(branch_length)
t.left(angle)
branch(t, branch_length * sf)
t.right(angle * 2)
branch(t, branch_length * sf)
t.left(angle)
t.backward(branch_length)


x = -300

for t in turtles:
t.speed(1000)
t.left(90)
t.color('brown')
t.pu()
x += randint(80, 160)
t.goto(x, randint(-100, 100))
t.pd()
branch(t, 100)

ts.getcanvas().postscript(file="tree.eps", height=842, width=595)
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import forrest
85 changes: 85 additions & 0 deletions multiple_colored_shapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#https://pythonforfun.in/2021/02/03/five_shapes-polygons-and-a-star-sort-of/
import turtle
import random

wn = turtle.Screen()
wn.bgcolor("black")
astroid = turtle.Turtle()
astroid.speed(0)
triad = turtle.Turtle()
triad.speed(0)
triad.up()
triad.goto(-120, 120)
triad.down()
squad = turtle.Turtle()
squad.speed(0)
squad.up()
squad.goto(120, 120)
squad.down()
pentago = turtle.Turtle()
pentago.speed(0)
pentago.up()
pentago.goto(-120, -120)
pentago.down()
octago = turtle.Turtle()
octago.speed(0)
octago.up()
octago.goto(120, -120)
octago.down()
colors = ["red", "gold", "blue", "green", "white", "cyan", "pink"]

for i in range(50):
triad.color(random.choice(colors))
triad.forward(i * 3)
triad.left(120)

for i in range(50):
squad.color(random.choice(colors))
squad.forward(i * 2)
squad.left(90)

for i in range(50):
pentago.color(random.choice(colors))
pentago.forward(i * 2)
pentago.left(72)

for i in range(75):
octago.color(random.choice(colors))
octago.forward(i)
octago.left(60)

for i in range(50):
astroid.color(random.choice(colors))
astroid.forward(i * 3)
astroid.left(144)

triad.up()
triad.goto(-110, 200)
triad.down()
triad.write("Triad")
triad.hideturtle()

squad.up()
squad.goto(120, 180)
squad.down()
squad.write("Squad")
squad.hideturtle()

pentago.up()
pentago.goto(-140, -20)
pentago.write("Pentago")
pentago.hideturtle()

octago.up()
octago.goto(120, -40)
octago.down()
octago.write("Hex")
octago.hideturtle()

astroid.up()
astroid.goto(0, 60)
astroid.down()
astroid.write("Astroid")
astroid.hideturtle()

turtle.done()
31 changes: 31 additions & 0 deletions stjerne.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from turtle import *

speed(100)

color('red', 'yellow')

t1 = Turtle()
t2 = Turtle()
t3 = Turtle()
t4 = Turtle()

turtles = [t1, t2, t3, t4]

for t in turtles:
star(t)


def star(turt):

begin_fill()
while True:
turt.forward(200)
turt.left(170)
if abs(pos()) < 1:
break
end_fill()


star()

done()
21 changes: 21 additions & 0 deletions weird_circle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import turtle

t = turtle.Turtle()

t.speed(100)

for i in range(180):
t.forward(100)
t.right(30)
t.forward(20)
t.left(60)
t.forward(50)
t.right(30)

t.penup()
t.setposition(0, 0)
t.pendown()

t.right(2)

t.done()

0 comments on commit 083dcca

Please sign in to comment.