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])