Untitled
unknown
plain_text
a year ago
1.1 kB
9
Indexable
import random HEADS = "heads" TAILS = "tails" COIN_VALUES = [HEADS, TAILS] def flip_coin(): return random.choice(COIN_VALUES) def play_martingale(*, starting_founds: int, min_bet: int, man_bet: int) -> int: steps_to_loose = 0 current_founds = starting_founds current_bet = min_bet while current_founds > 0: print("=======") steps_to_loose += 1 current_founds -= current_bet print(f"{current_founds=}, {current_bet=}") fliped_coin_value = flip_coin() if fliped_coin_value == HEADS: win = current_bet * 2 print(f"{win=}") current_founds += win current_bet = min_bet else: print("loose") current_bet *= 2 if current_bet > man_bet: current_bet = min_bet if current_bet > current_founds: current_bet = current_founds return steps_to_loose print(play_martingale(starting_founds=100, min_bet=1, man_bet=100))
Editor is loading...
Leave a Comment