fuji.py

Created by cent20

Created on May 03, 2022

1.63 KB

Le mont Fuji


# Réalisé par un élève de seconde dans le cadre d'un DM
# les mathématiques sont belles 
# https://twitter.com/nsi_xyz/status/1507684348820082690
from turtle import *
from kandinsky import *

speed(0) #vitesse

#fond
for i in range(240):
  fill_rect(0, i, 320, 1, (179,223,248))

#fonctions
def soleil(x, y):
    #dégradé
    for i in range(86):
        fill_rect(118, i + 10, 85, 1, (255, i + 127, i + 39))

    pensize(30)
    pencolor(179,223,248)
    for i in range(360):
        forward(0.9)
        left(1)
    pencolor("black")
    pensize(1)


def nuage(x, y):
    penup()
    goto(x, y)
    pendown()
    pensize(2)
    pencolor("white")
    left(180)
    forward(100)
    right(90)

    listrange = [60, 90, 153]
    listforward = [0.9, 0.7, 0.3]
    listright = [2, 2, 1]

    for i in range(3):
        for j in range(listrange[i]):
            forward(listforward[i])
            right(listright[i])
        left(120)
    right(357)
    
def fuji(x, y):
    penup()
    goto(x, y)
    pensize(5)
    pencolor(191,107,92)
    pendown()
    left(60)

    listpas = [55,9,80,45,15,95]
    listdirection = [240,120,240,120,240,120]

    for i in range(6):
        forward(listpas[i])
        left(listdirection[i])
        
#reflet
    penup()
    goto(-75,-50)
    pensize(5)
    pencolor(202,135,151)
    pendown()
    left(60)
    
    for i in range(6):
        forward(listpas[i]*-1)
        left(listdirection[i]*-1)

#position
soleil(50, 40)
nuage(110, 50)
nuage(-10, 1)
nuage(-90, 60)
nuage(200, 10)

fuji(-75,-50)

#sol
right(120)
penup()
goto(0,-50)
pendown()
pensize(5)
pencolor(7,72,78)
forward(200)
right(180)
forward(400)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.