Skip to content

Instantly share code, notes, and snippets.

Created August 1, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/41ceeedd5692084dcdc141cdd2fe6490 to your computer and use it in GitHub Desktop.
Save anonymous/41ceeedd5692084dcdc141cdd2fe6490 to your computer and use it in GitHub Desktop.
from collections import deque
import math
import itertools
bccHashRatio = 0.25
checkpoints = [30, 60, 2*60, 24*60]
def fmtTime(time):
time = math.floor(time)
out = str(math.floor(time / 24 / 60))
time = time % (24 * 60)
out += "\t"
out += str(math.floor(time / 60))
out += ":"
time = time % 60
if time < 10:
out += "0"
out += str(time)
return out
time = 0
currentTime = 10 / bccHashRatio
blocksUntilAdjustment = 1400
pastBlockTimes = deque(itertools.repeat(10, 2022))
while True:
pastBlockTimes.popleft()
pastBlockTimes.append(currentTime)
blocksUntilAdjustment -= 1
while len(checkpoints):
if currentTime < checkpoints[-1]:
print(str(checkpoints.pop()) + ":\t" + str(fmtTime(time)))
else:
break
if len(checkpoints) == 0:
break
time += currentTime
if blocksUntilAdjustment == 0:
blocksUntilAdjustment = 2016
adj = max(20160 / sum(pastBlockTimes[n] for n in range(2016)), 0.25)
currentTime *= adj
elif sum(pastBlockTimes[n] for n in range(2004, 2010)) > 12*60:
currentTime *= 0.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment