# spirales_enchantes.py

Created by cent20

Created on December 19, 2021

1.66 KB

```# Auteur : Aël D.
# Réalisé par un de mes élèves de seconde
# dans le cadre d'un DM "Les mathématiques sont belles"

from math import *
from turtle import *
from random import *

speed(10)
hideturtle()

def spirale(a,xS,yS,longr,nbr,clr):
penup()
goto(xS,yS)
pendown()
for f in range (2500):
x=randint(0,255)
pencolor(f/clr,x,clr)
forward(f/longr)
penup()
goto(xS,yS)
pendown()

def lignes(xL,yL,dis,ran1,ran2):
penup()
goto(xL,yL)
pendown()
for l in range(ran1,ran2):
x=randint(0,255)
color(210,210,210)
forward(dis)
goto(xL,yL)

def clean(C,xC,yC,longrC,nbrC):
penup()
goto(xC,yC)
pendown()
pensize(2)
for f in range (2500):
pencolor(255,255,255)
forward(f/longrC)
penup()
goto(xC,yC)
pendown()

def autres():
pensize(2)
clean(1,-100,100,3000,288)
clean(1,-100,-100,3000,288)
clean(1,100,100,3000,288)
clean(1,100,-100,3000,288)
pensize(1)
for g5 in range(3):
spirale(g5,-150,0,3000,288,13)
for g6 in range(3):
spirale(g6,150,0,3000,288,14)
for g7 in range(3):
spirale(g7,0,-150,3000,288,15)
for g8 in range(3):
spirale(g8,0,150,3000,288,16)

def principal():
pensize(2)
for g in range(6):
spirale(g,0,0,1500,72,10)
pensize(1)

pensize(1)
lignes(0,0,200,0,45)
lignes(-100,-100,350,0,24)
lignes(-100,100,350,23,46)
lignes(100,-100,350,0,24)
lignes(100,100,350,23,46)
pensize(10)
for c in range (6):
clean(c,0,0,1500,72)
principal()
penup()
goto(-100,-100)
pendown()
pensize(1)
autres()```