• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Jun 17th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import random as r
2. ## 50% true or false
3. ## false is lost bet
4. def flipcoin():
5.     flip = r.randint(0,1)
6.     return flip == 1
7. if __name__ == '__main__':
8.     base_bet = 10
9.     money = 100000
10.     current_bet = base_bet
11.     goal = money * 2
12.     increase_factor = 2
13.     highest_bet = 1
14.     wait = 10
15.     lose_counter = 0
16.     total_games = 0
17.     while money > 0 and money < goal:
18.         total_games += 1
19.         toss_result = flipcoin()
20.         cur_counter = lose_counter
21.         if not toss_result:
22.             lose_counter += 1 # lost again
23.         else:
24.             lose_counter = 0 # reset counter if win
25.         if cur_counter < wait:
26.             continue # only bet when there are WAIT losses in a row
27.         print ("Bet: " + str(current_bet) + " Money remaining: " + str(money) + " Highest bet: " + str(highest_bet))
28.         if current_bet > highest_bet:
29.             highest_bet = current_bet
30.         if toss_result:
31.             money += current_bet # we are betting, but won
32.             current_bet = base_bet # reset bet
33.         else:
34.             money -= current_bet # we are betting, and doubling next bet if we lost
35.             current_bet *= increase_factor
36.
37.     print ("Final money: " + str(money))
38.     print ("Final bet: " + str(current_bet))
39.     print ("Highest bet: " + str(highest_bet))
40.     print ("Total games: " + str(total_games))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?