Again, I've included the Python code where you can simulate the game. The variables are set so that you can't lose more than 200 chips, but I've also programmed a progression of bets. By simply changing the win/loss limits, you can simulate longer games, with different bet progressions. I don't recommend this too much, though. Not everyone has Bond's luck.
At the same time, I refactored the code for Martingale so that the cycle is not driven by the number of rounds, but by the limits on losing and winning, as it is here. I found that this stretched the code quite a bit and made some lines repetitive, so I may redo this in the future using some function.
import random
# Player variables
# =======================================
budget = 100_000
win_limit = 80
loss_limit = 201
highs_bet = 140
double_street_bet = 50
zero_bet = 10
progresion = 1
# =======================================
# Game simulation
actual_budget = budget
bet = highs_bet + double_street_bet + zero_bet
actual_highs_bet = highs_bet
actual_double_street_bet = double_street_bet
actual_zero_bet = zero_bet
highs = [i for i in range(19, 37)]
double_street = [13, 14, 15, 16, 17, 18]
spin = 1
game_limits = True
while game_limits:
bet = actual_highs_bet + actual_double_street_bet + actual_zero_bet
if actual_budget - bet <= budget - loss_limit:
break
fallen_number = random.randint(0, 36)
print(f"Your bet is {actual_highs_bet + actual_double_street_bet + actual_zero_bet}")
print(f"{spin}. spin, the number {fallen_number} fell.")
spin += 1
if fallen_number in highs:
win = actual_highs_bet - actual_double_street_bet - actual_zero_bet
print(f"You win {win}!")
actual_budget += win
print(f"Your budget is {actual_budget}")
actual_highs_bet = highs_bet
actual_double_street_bet = double_street_bet
actual_zero_bet = zero_bet
elif fallen_number in double_street:
win = actual_double_street_bet * 5 - actual_highs_bet - actual_zero_bet
print(f"You win {win}!")
actual_budget += win
print(f"Your budget is {actual_budget}")
actual_highs_bet = highs_bet
actual_double_street_bet = double_street_bet
actual_zero_bet = zero_bet
elif fallen_number == 0:
win = actual_zero_bet * 35 - actual_highs_bet - actual_double_street_bet
print(f"You win {win}!")
actual_budget += win
print(f"Your budget is {actual_budget}")
actual_highs_bet = highs_bet
actual_double_street_bet = double_street_bet
actual_zero_bet = zero_bet
else:
print(f"You loose {actual_highs_bet + actual_double_street_bet + actual_zero_bet}")
actual_budget -= actual_highs_bet + actual_double_street_bet + actual_zero_bet
print(f"Your budget is {actual_budget}")
actual_highs_bet = actual_highs_bet * progresion
actual_double_street_bet = actual_double_street_bet * progresion
actual_zero_bet = actual_zero_bet * progresion
print()
if actual_budget >= budget + win_limit or actual_budget - bet < budget - loss_limit:
game_limits = False
print("====================================")
print(f"you have reached your limit")
print(f"Your budget is {actual_budget}.")
print("====================================")
Again, I've included the Python code where you can simulate the game. The variables are set so that you can't lose more than 200 chips, but I've also programmed a progression of bets. By simply changing the win/loss limits, you can simulate longer games, with different bet progressions. I don't recommend this too much, though. Not everyone has Bond's luck.
At the same time, I refactored the code for Martingale so that the cycle is not driven by the number of rounds, but by the limits on losing and winning, as it is here. I found that this stretched the code quite a bit and made some lines repetitive, so I may redo this in the future using some function.
import random # Player variables # ======================================= budget = 100_000 win_limit = 80 loss_limit = 201 highs_bet = 140 double_street_bet = 50 zero_bet = 10 progresion = 1 # ======================================= # Game simulation actual_budget = budget bet = highs_bet + double_street_bet + zero_bet actual_highs_bet = highs_bet actual_double_street_bet = double_street_bet actual_zero_bet = zero_bet highs = [i for i in range(19, 37)] double_street = [13, 14, 15, 16, 17, 18] spin = 1 game_limits = True while game_limits: bet = actual_highs_bet + actual_double_street_bet + actual_zero_bet if actual_budget - bet <= budget - loss_limit: break fallen_number = random.randint(0, 36) print(f"Your bet is {actual_highs_bet + actual_double_street_bet + actual_zero_bet}") print(f"{spin}. spin, the number {fallen_number} fell.") spin += 1 if fallen_number in highs: win = actual_highs_bet - actual_double_street_bet - actual_zero_bet print(f"You win {win}!") actual_budget += win print(f"Your budget is {actual_budget}") actual_highs_bet = highs_bet actual_double_street_bet = double_street_bet actual_zero_bet = zero_bet elif fallen_number in double_street: win = actual_double_street_bet * 5 - actual_highs_bet - actual_zero_bet print(f"You win {win}!") actual_budget += win print(f"Your budget is {actual_budget}") actual_highs_bet = highs_bet actual_double_street_bet = double_street_bet actual_zero_bet = zero_bet elif fallen_number == 0: win = actual_zero_bet * 35 - actual_highs_bet - actual_double_street_bet print(f"You win {win}!") actual_budget += win print(f"Your budget is {actual_budget}") actual_highs_bet = highs_bet actual_double_street_bet = double_street_bet actual_zero_bet = zero_bet else: print(f"You loose {actual_highs_bet + actual_double_street_bet + actual_zero_bet}") actual_budget -= actual_highs_bet + actual_double_street_bet + actual_zero_bet print(f"Your budget is {actual_budget}") actual_highs_bet = actual_highs_bet * progresion actual_double_street_bet = actual_double_street_bet * progresion actual_zero_bet = actual_zero_bet * progresion print() if actual_budget >= budget + win_limit or actual_budget - bet < budget - loss_limit: game_limits = False print("====================================") print(f"you have reached your limit") print(f"Your budget is {actual_budget}.") print("====================================")