Skip to content

Instantly share code, notes, and snippets.

@Hoffs
Created May 18, 2017 18:00
Show Gist options
  • Save Hoffs/33fd243741d9256495f9ee2229c66a6f to your computer and use it in GitHub Desktop.
Save Hoffs/33fd243741d9256495f9ee2229c66a6f to your computer and use it in GitHub Desktop.
Double up doesn't work
import random
allbank = 0
alliter = 0
allmax = 0
itt = 0
it = 10000
for i in range(0, it):
itt += 1
bank = 1024
bet = 1
maxb = bank
iteration_count = 0
while bank > bet:
iteration_count += 1
bank -= bet
if random.randint(1, 37) <= 16:
bank = bank + (bet * 2)
bet = 1;
else:
bet = bet * 2
if bank > maxb:
maxb = bank
alliter += iteration_count
allbank += bank
allmax += maxb
print(itt)
print(allbank/it)
print(alliter/it)
print(allmax/it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment