Saturday, December 16, 2023

Wager simulation

import random

# Define parameters
starting_bet = 0.03
multiplier = 6.6
win_chance = 0.15 # 15%
win_increase = 1.0 # 100% increase per win
target_amount = 10.0

# Function to simulate a single game
def simulate_game():
    bet = starting_bet
    consecutive_wins = 0
    while bet < target_amount:
        win = random.random() < win_chance
        if win:
            consecutive_wins += 1
            bet *= multiplier * win_increase
        else:
            consecutive_wins = 0
            bet = starting_bet
    return consecutive_wins

# Run simulations and collect results
num_simulations = 1000 # Increase for more accurate results
win_streaks = []
for _ in range(num_simulations):
    win_streaks.append(simulate_game())

# Analyze and print results
average_win_streak = sum(win_streaks) / len(win_streaks)
print(f"Average win streak needed: {average_win_streak:.2f}")

# Calculate and print success rates for different win streak lengths
success_rates = {}
for i in range(1, max(win_streaks) + 1):
    success_rates[i] = sum(w >= i for w in win_streaks) / len(win_streaks)
print("--- Success Rates by Win Streak Length ---")
for streak, rate in success_rates.items():
    print(f"{streak} wins: {rate:.2%}")


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home