Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2016 18:06
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/47f21c9af208834278d2 to your computer and use it in GitHub Desktop.
Save anonymous/47f21c9af208834278d2 to your computer and use it in GitHub Desktop.
daily budget
from random import random
wallet = 0
games_to_play = 10
up, down = 0, 0
for y in range(365):
winnings = 0
daily_budget = 250
for x in range(games_to_play):
if daily_budget < 250:
break
winnings -= 250 # Gotta pay to play.
daily_budget -= 250
current_play = 0
cards_drawn = 0
while current_play <= 1:
random_number = round(random(), 1)
current_play += random_number
cards_drawn += 1
else:
winnings += cards_drawn * 100
daily_budget += cards_drawn * 100
if winnings > 0:
up += 1
else:
down += 1
wallet += winnings
print("Walked away up: {} days".format(up))
print("Walked away down: {} days".format(down))
print("Money in wallet at end ${}".format(wallet))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment