Lower base and render scores in exponential notation

This commit is contained in:
Robert Miles 2021-06-04 16:48:30 +00:00
parent ce280f8771
commit 976cf41282
1 changed files with 6 additions and 5 deletions

View File

@ -47,8 +47,9 @@ def deactivate_bun(channel):
# 2020-11-17 - A 4:46:01.66 bun awards 3 billion and a 6:08:09.27 awards over a trillion. Base is lowered from 100.
# 2020-12-03 - After some fun with really long buns, I decide enough is enough and lower the base even more. Base lowered from 10.
# 2020-12-14 - Late Monday night I decide to lower the base slightly, from 5.
# 2021-06-04 - I decide to lower the base from 3, after almost 6 months of just leaving it as-is.
# This is probably too much and too easily abused but hell we'll give it a shot.
BASE = 3**(1/(60*60))
BASE = 2**(1/(60*60))
def bun_score(time_delta):
"""Generates the score for a bun."""
return BASE**time_delta
@ -109,9 +110,9 @@ def on_befriend(event):
delta_r = round(final_delta,2)
score_r = round(score,2)
if first_bun:
respond(event,f"Congratulations on your first bun! This bun has waited {delta_r:,} second(s), and is therefore worth {score_r:,} point(s)!")
respond(event,f"Congratulations on your first bun! This bun has waited {delta_r:,} second(s), and is therefore worth {score_r:.2e} point(s)!")
else:
respond(event,f"This bun has waited {delta_r:,} second(s), and is therefore worth {score_r:,} point(s)!")
respond(event,f"This bun has waited {delta_r:,} second(s), and is therefore worth {score_r:.2e} point(s)!")
def on_peek(event):
if not event.target.startswith("#"): return
@ -121,7 +122,7 @@ def on_peek(event):
score, delta = get_bun_score(event.target)
delta_r=round(delta,2)
score_r=round(score,2)
respond(event,f"If you were to befriend the bun right now, it would have waited {delta_r:,} second(s), and would therefore be worth {score_r:,} point(s).")
respond(event,f"If you were to befriend the bun right now, it would have waited {delta_r:,} second(s), and would therefore be worth {score_r:.2e} point(s).")
average = lambda l: sum(l)/len(l)
@ -159,7 +160,7 @@ def on_top10(event):
if mode == "count":
out += "{act[0]} ({act[1]:n})".format(act=account)
else:
out += "{act[0]} ({act[1]:,.02f})".format(act=account)
out += "{act[0]} ({act[1]:.2e})".format(act=account)
out+=", "
out=out[:-2]
respond(event,out)