Skip to content

Instantly share code, notes, and snippets.

@rbreve
Last active December 15, 2015 21:18
Show Gist options
  • Save rbreve/5324320 to your computer and use it in GitHub Desktop.
Save rbreve/5324320 to your computer and use it in GitHub Desktop.
Sathoshi Dice simulator
import random
total_bitcoins=5
amount_to_bet=1
rounds=20
# probability -> multiplier
# 0.915527 -> 1.07
# 0.732422 -> 1.34
# 0.500000 -> 1.96
# 0.488281 -> 2.00
# 0.366211 -> 2.67
# 0.244141 -> 4
# 0.183105 -> 5.34
# 0.12207 -> 8
# 0.030518 -> 31.99
probability=0.244141
mult=4
random.seed()
print "will play "+str(rounds)+" rounds "
for x in range(1,rounds):
total_bitcoins-=amount_to_bet
r=random.random()
if (r<=probability):
total_bitcoins+=amount_to_bet*mult
print total_bitcoins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment