piday.py

Created by schraf

Created on March 13, 2023

314 Bytes

Petit script en 314 octets pour célébrer le 14 mars, journée de π


from kandinsky import *
from random import random
ds = draw_string
t,c = 0,1
G = "grey"
ds("DAY",230,130,G)
while True:
 x,y = random(),random()
 d = ((x-.5)**2+(y-.5)**2)<=.25
 t += d
 c += 1
 set_pixel(10+int(200*x),10+int(200*y), ("k",G)[d])
 a = str(4*t/c)
 ds(a[:4],230,100,G)
 ds(a[4:7],270,100)