# popit.py

Created by schraf

Created on January 28, 2024

1.13 KB

Playlist NUMWORKS de ma chaine Youtube

Put your your score in comment / Mets ton score en commentaire !

```from kandinsky import *
from ion import keydown
from time import monotonic
from random import randint

def onOff(i, style):
if i < 20:
t, y = 45, i // 5
a, e = 5, 0
coul = i // a
else:
i -= 20
t, y = 37, 4 + i // 6
a, e = 6, 2
coul = i // a + 4
x = (i % a) * t
fill_rect(26 + x + e, 187 - 30 * y, t - 2, 25, style[coul])

def init():
fill_rect(0, 0, 320, 222, (0, 0, 0))
for r in range(7):
fill_rect(20, 185 - 30 * r, 235, 29, light[r])
for i in range(38):
onOff(i, dark)

codes = []
for c in range(7):
e = 0 if c < 4 else 1
codes += list(range(48 - 6 * c, 53 + e - 6 * c))

light = (252, 61, 33),(252, 159, 0),(252, 237, 0), (54, 205, 0),(35, 196, 242),(181, 101, 241),(252, 61, 33)
dark = (208, 7, 0),(224, 94, 0),(241, 181, 0),(41, 151, 0),(10, 137, 204),(136, 51, 208),(208, 7, 0)

while True:
init()
i = 0
while i < 38:
while not (keydown(codes[i])):
continue
if i == 0:
t = monotonic()
draw_string("{0:.2f}".format(monotonic() - t), 270, 100, (255,) * 3, (0, 0, 0))
onOff(i, light)
i += 1
t = monotonic()
while monotonic() - t < 4:
onOff(randint(0, 37), [light, dark][randint(0, 1)])```