sierpinski_chaos.py

Created by telpe51

Created on November 23, 2018

550 Bytes


from kandinsky import *
from math import *
from random import *
def iterer(n):
    c=color(255,0,250)
    sommet1=[160,10]
    sommet2=[45,210]
    sommet3=[275,210]
    liste_somm=[sommet1,sommet2,sommet3]
    set_pixel(160,10,c)
    set_pixel(45,210,c)
    set_pixel(275,210,c)
    #x=randint(100,200)
    #y=randint(100,200)
    x,y=140,100
    set_pixel(x,y,c)
    for i in range(n):
        a=randint(0,2)
        x=int((x+liste_somm[a][0])/2)
        y=int((y+liste_somm[a][1])/2)
        set_pixel(x,y,c)
#iterer(50000)

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.