Created
October 22, 2021 10:00
-
-
Save dimaqq/8c79721ae72142230d8ca750304143ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import math | |
import sys | |
start = time.time() | |
total = int(sys.argv[1]) * 60 | |
deadline = start + total | |
def remains(): | |
now = time.time() | |
if now > deadline: | |
return 0 | |
else: | |
return deadline - now | |
def format(secs): | |
secs = int(secs) | |
if not secs: | |
return "##:##" | |
minutes = secs // 60 | |
seconds = secs % 60 | |
return "% 2d:%02d" % (minutes, seconds) | |
def fun(secs): | |
now = time.time() | |
ceil = min(secs**2 / 100, (start - now)**2 / 100, 60) | |
extra = max(0, math.sin(secs / 14.2))**4 * ceil | |
return secs + extra | |
while True: | |
time.sleep(.05) | |
print(f"\n {format(fun(remains()))}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment