'''
so now we've got a bettor, he's working, and we've seen some basic outcomes
but now we want to see some longer-term outcomes, so first let's do that.
'''
import random
# let us go ahead and change this to return a simple win/loss
def rollDice():
roll = random.randint(1,100)
if roll == 100:
#print roll,'roll was 100, you lose. What are the odds?! Play again!'
return False
elif roll <= 50:
#print roll,'roll was 1-50, you lose.'
return False
elif 100 > roll >= 50:
#print roll,'roll was 51-99, you win! *pretty lights flash* (play more!)'
return True
'''
Simple bettor, betting the same amount each time.
'''
def simple_bettor(funds,initial_wager,wager_count):
value = funds
wager = initial_wager
currentWager = 0
while currentWager < wager_count:
if rollDice():
value += wager
else:
value -= wager
currentWager += 1
# changed to reduce spam
if value < 0:
value = 'Broke!'
print 'Funds:', value
# lots of wagers now....
x = 0
while x < 100:
simple_bettor(10000,100,50)
x += 1
Interestingly enough, you can see there is quite the spread here.
Keep in mind, the odds are only 1% against you.
Now we can see most people have gone broke, all but 1 person is either broke or a loser. Interestingly sometimes you find people actually make large profits.
This visualization, however, is sub par. let's add to this, shall we?