Thursday, December 28, 2023

check

def simulate_scenario(starting_bet):
    bankroll = 100
    winning_multiplier = 6.6
    win_chance = 0.15 # 15%
    consecutive_losses_reset = 2

    # Variables to keep track of win streaks
    current_win_streak = 0
    longest_win_streak = 0
    ending_bankroll = 0

    # Simulate 10000 bets
    consecutive_losses = 0
    for _ in range(10000):
        # Place the bet
        if random.random() < win_chance: # Win
            bankroll += starting_bet * winning_multiplier
            starting_bet *= 2 # Increase the bet by 100% after a win
            consecutive_losses = 0 # Reset consecutive losses counter
            current_win_streak += 1
            if current_win_streak > longest_win_streak:
                longest_win_streak = current_win_streak
        else: # Loss
            bankroll -= starting_bet
            consecutive_losses += 1
            current_win_streak = 0 # Reset current win streak counter
            if consecutive_losses == consecutive_losses_reset:
                starting_bet = starting_bet - 0.002 if starting_bet > 0.002 else 0.001 # Decrease bet by 0.002 or set to minimum 0.001
                consecutive_losses = 0

    ending_bankroll = bankroll
    return ending_bankroll, longest_win_streak

Saturday, December 16, 2023

wager simulation

import random


# Define parameters

starting_wager = 0.03

multiplier = 7.0714

win_chance = 0.14

win_increase = 0.8

consecutive_losses_reset = 2

num_simulations = 1000

num_games_per_simulation = 1000


# Desired win streak lengths to track

desired_win_streaks = [2, 3, 4, 5]


# Function to simulate a single game

def simulate_game():

  current_wager = starting_wager

  consecutive_losses = 0

  consecutive_wins = 0

  win_streak_counts = {streak: 0 for streak in desired_win_streaks} # Initialize streak counters

  for _ in range(num_games_per_simulation):

    win = random.random() < win_chance

    if win:

      consecutive_wins += 1

      consecutive_losses = 0

      for streak in desired_win_streaks: # Update counters for desired streaks

        if consecutive_wins >= streak:

          win_streak_counts[streak] += 1

    else:

      consecutive_wins = 0

      consecutive_losses += 1

      if consecutive_losses == consecutive_losses_reset:

        current_wager = starting_wager

        consecutive_losses = 0

  return current_wager, win_streak_counts


# Run simulations and collect results

total_win_streaks = {streak: 0 for streak in desired_win_streaks}

for _ in range(num_simulations):

  _, win_streak_counts = simulate_game()

  for streak, count in win_streak_counts.items():

    total_win_streaks[streak] += count


# Analyze and print results

average_win_streak = sum(total_win_streaks.values()) / num_simulations

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(desired_win_streaks) + 1):

  success_rates[i] = sum(w >= i for w in total_win_streaks.values()) / len(total_win_streaks)

print("--- Success Rates by Win Streak Length ---")

for streak, rate in success_rates.items():

  print(f"{streak} wins: {rate:.2%}")


# Print specific win streak occurrences

print("--- Consecutive Win Occurrences ---")

for streak, count in total_w

in_streaks.items():

  print(f"{streak} wins: {count}")


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%}")