glace.py

Created by schraf

Created on September 20, 2022

510 Bytes


from math import sin,cos,pi
from random import randint
from kandinsky import fill_rect,set_pixel,get_pixel

coul = [(40,40,40),(96,132,128),(112,152,152),(152,200,200),(168,240,248),(200,248,248)]
fill_rect(0,0,320,222,coul[0])

p,q = [],[]
r,x,y = 0,0,0

for i in range(50000):
  r = (randint(6,9) + r) % 6
  x = (x + 128 * cos(r * pi / 3)) / 2
  y = (y + 128 * sin(r * pi / 3)) / 2
  xx,yy = 160 + int(x), 110 - int(y)
  g = min(5, coul.index(get_pixel(xx, yy)) + 1)
  set_pixel(xx, yy, coul[g])

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.