testing.py

Created by polettielio

Created on October 15, 2022

381 Bytes

a click speed test execute tt() and optionally add a time argument (in seconds) (8 seconds by default) you then have that much time to press the “x10” key as much as you can ! once finished, tt returns your score and your average click per second


from time import monotonic as mo, sleep
from ion import keydown as kd, KEY_EE as ee

def tt(s=8):
  print(s,"sec, key x10^")
  for i in ("1...","2...","3..."):
    print(i)
    sleep(1)
  print("Go!")
  a=mo()
  c=[0,False]
  while a+s > mo():
    x=kd(ee)
    if x!=c[1]:
      c[0]+=1
      c[1]=x
  print(round((c[0]//2)/s,2),"per s, tot:",c[0]//2)

print("tt()")