press the key whose number is printed in the currently appearing crate on the screen you have 5 seconds to break as many crates as you can (the countdown stops when there’s nothing to break)
be carfeful ! breaking a crate that isn’t shown will give you bad points !
from random import randint as rd from ion import keydown as kd from time import * from kandinsky import fill_rect as fr, draw_string as ds def play(ti=15,m=1,min=0,max=5): def sc(c=(255,)*3): fr(0,0,320,222,c) def hh(ha): return (42,43,44,36,37,38,30,31,32)[ha-1] def cc(): return [16*rd(1,16)-1 for _ in range(3)] def tt(ta=0): b="{}/{}".format(u,v) ds(b,160-5*len(b),91) b=str(round(t,3)) ds(b,160-5*len(b),111) def ovt(ooa=0): oox=89 if ooa<2 else 160 if ooa%2==1: global u, o oob="{}/{}".format(u,o) ds(oob,160-5*len(oob),oox) global t oob=str(round(t,3))[:4] fr(160-40,oox+20,80,20,(255,)*3) ds(oob,160-5*len(oob),oox+20) def dd(dx,dy,dt): da=cc() fr(dx,dy,80,80,(0,)*3) fr(dx+5,dy+5,70,70,da) dt=str(dt) ds(dt,dx+40-(len(dt)*5),dy+30,(0,)*3,da) def ss(sa): ovt(3 if sa==5 else 1) global t dd(120*((sa-1)%3),142-71*((sa-1)//3),sa) while t>0: st=monotonic() ovt(2 if sa==5 else 0) for i in range(1,10): if kd(hh(i)): return True if sa==i else False t-=monotonic()-st global t, u, o u=0 o=0 t=float(ti) while t>0: sc() o+=1 ovt(1) if m>0: sleep(rd(min*100,max*100)/100) if ss(rd(1,9)): u+=1 sc() dd(20,71,"end!") dd(120,71,"{}/{}".format(u,o)) dd(220,71,"end!") print("play()")