boat.py

Created by schraf

Created on October 15, 2022

922 Bytes

Modèle d’origine


import turtle
from kandinsky import fill_rect

fill_rect(0,0,320,222,(0,0,0))
t = turtle
t.speed(0) ; t.hideturtle()

def clou(A, dep = 0):
  t.pensize(3) ; t.color((160,140,130))
  if dep: t.penup(); t.goto(A); t.pendown(); 
  t.goto(A)

def fil(A,B,c):
  clou(A, 1) ; t.pensize(1) ; t.pencolor(c) ; 
  t.goto(B) ; clou(B)
  
def segment(a,b,n):
    return [((i*PTS[b][0]+(n-1-i)*PTS[a][0])/(n-1), (i*PTS[b][1]+(n-1-i)*PTS[a][1])/(n-1)) for i in range(n)]

def remplir(S1, S2, c):
  for i in range(len(S1)):
    fil(S1[i], S2[i], c)
    if i < len(S1) - 1 : fil(S2[i], S1[i+1], c)

PTS = (-71,-50),(0,-55),(1,98),(-31,-61),(71,-58),(-68,-62),(-61,-76),(71,-62),(63,-82),(-78,-93),(83,-98)
remplir(segment(0,1,20), segment(2,1,20), (180,40,30))
remplir(segment(3,4,20), segment(4,2,20), (240,30,50))
remplir(segment(5,6,6), segment(7,8,6), (120,150,160))
remplir(segment(6,9,10), segment(8,10,10), (0,100,240))

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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.