soleilmer.py

Created by schraf

Created on September 02, 2022

593 Bytes


from kandinsky import get_pixel, set_pixel,fill_rect
from random import random, randint
from math import log
import turtle

fill_rect(0, 0, 320, 222, (0,105,105))

for l in range(222):
 y = l
 for x in range(320):
  y += 2*random()-1
  c = min(255, get_pixel(x,int(y))[1] + 50)
  set_pixel(x,int(y),(0,c,c))

t = turtle
t.pendown()
t.color((255,0,0))
t.pensize(2)

while True:
 (x, y) = t.position()
 if x*x + y*y > 6400:
  t.penup()
  t.goto(0,0)
  t.pendown()
  cc = int(100+155*random())
  t.color((255,cc,0))
 else:
  t.setheading(randint(0,359))
  t.fd(-log(random())/.1)

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>.