Skip to content

Instantly share code, notes, and snippets.

@rynote
Created April 29, 2015 00:47
Show Gist options
  • Save rynote/6d25b520456e27367e6a to your computer and use it in GitHub Desktop.
Save rynote/6d25b520456e27367e6a to your computer and use it in GitHub Desktop.
Use this to see how long your initial investment in a dice game will last :P
#Use this to see how long your initial investment in a dice game will last :P
import sys
def sats2btc(sats):
return sats/100000000.0
def btc2str(btc):
return "{:1.8f}".format(btc)
def f(sats):
return btc2str(sats2btc(sats))
def main(base=10, increase=1.5):
total_wagered = 0.0
base = int(base)
print "Base = " + f(base)
print "Increase on loss = " + str(increase) + "x"
for n in range(1,40):
total_wagered += int(base)
profit = (int(base)*3.3) - total_wagered
print "Roll: %i - %s \t Total Wagered: %s \t Payout: %s \t Profit: %s" % (n, f(int(base)), f(total_wagered), f(int(base)*3.3), f(profit))
base *= (float(increase))
if __name__ == "__main__":
if len(sys.argv) == 1:
base = raw_input("What is Base best in satoshis? ")
increase = raw_input("What is the increase multiple on loss? ")
else:
base, increase = sys.argv[1], sys.argv[2]
main(base,increase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment