# sapin.py

Created by florian-allard

Created on December 17, 2020

1.99 KB

Morceau de participation pour le Concours de Noël 2020 organisé par Casio.

```from turtle import *
penup()
goto(-0,-70)
hideturtle()
#pendown()
pencolor((0,205,0))
pensize(2)
for k in [-1,1]:
penup()
goto(0,-70)
fd(15)
fd(16)
pendown()
for j in range(4):
for i in range(30):
fd(1-j/5)
lt(k*(1+i//20))
rt(50*k)
for i in range(10):
fd(-1+j/5)
lt(k*(-1-i//20))

lt(50*k)
for i in range(50):
fd(1-j/5)
lt(k*(i/30))
rt(40*k)
for i in range(40):
fd(-1+j/5)
lt(k*(-i//20))

lt(70*k)
for i in range(10):
fd(1-j/5)
lt(k*(1+i//20))
rt(30*k)
for i in range(40):
fd(-1+j/5)
lt(k*(-1-i//30))
for i in range(30):
fd(1/2)
lt(k*(1+i//20))
rt(40*k)
for i in range(20):
fd(-1/3)
lt(k*(-1-i//20))

lt(50*k)
for i in range(30):
fd(1/2)
lt(k*(i/10))
rt(60*k)
for i in range(30):
fd(-1/3)
lt(k*(i/20))

lt(20*k)
for i in range(30):
fd(1/2)
lt(k*(1+i//20))
#guirlandes
penup()
goto(10,60)
pendown()
pencolor((255,0,0))

for i in range(6):
pensize(5)
fd(3)
pensize(2)
fd(3)
rt(5)

for i in range(10):
pensize(5)
fd(3)
pensize(2)
fd(3)
lt(6)

for i in range(12):
pensize(5)
fd(3)
pensize(2)
fd(3)
rt(4)

for i in range(13):
pensize(5)
fd(3)
pensize(2)
fd(3)
lt(6)

for i in range(15):
pensize(5)
fd(3)
pensize(2)
fd(3)
rt(6)

for i in range(13):
pensize(5)
fd(3)
pensize(2)
fd(3)
lt(6)

#boules
from random import randint
for coord in [(17,32),(-17,24),(-60,-10),(15,0),(-30,-40),(40,-50)]:
penup()
goto(coord[0],coord[1])
pensize(12)
pencolor((255*randint(1,10)/10,255*randint(1,10)/10,255*randint(1,10)/10))
pendown()
fd(1)

#etoile
penup()
goto(-10,90)
pendown()
pencolor((220,220,40))
pensize(5)