도박회사 승률51.0%, 개인 승률 49.0% 이면 1000 게임 진행시 개인이 1억 으로 1백만원씩 배팅 하면 결과는 ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# The scenario involves a person betting 1 million KRW per game with a 49.9% probability of winning, # and we want to simulate the outcome over 1000 games. Let's calculate the likely outcome over these games. import numpy as np # Initial variables initial_capital = 100000000 # Starting with 100 million KRW bet_amount = 1000000 # Betting 1 million KRW per game win_probability = 0.49 # 49.0% chance of winning num_games = 1000 # Number of games to simulate # Function to simulate the betting outcome def simulate_betting(capital, bet, win_prob, games): for game in range(games): if np.random.rand() < win_prob: capital += bet # Win case: increase capital by bet amount else: capital -= bet # Loss case: decrease capital by bet amount if capital <= 0: # Stop if capital is lost break return capital # Run the simulation final_capital = simulate_betting(initial_capital, bet_amount, win_probability, num_games) print(final_capital) |
결과
90000000
10만원 부터 1000만원 까지의 배팅시 결과를 그래프로
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# Re-importing necessary packages and re-running the code to simulate results import numpy as np import matplotlib.pyplot as plt # Initial variables initial_capital = 100000000 # Starting with 100 million KRW win_probability_new = 0.49 # 49% chance of winning num_games = 1000 # Number of games to simulate # Function to simulate the betting outcome def simulate_betting(capital, bet, win_prob, games): for game in range(games): if np.random.rand() < win_prob: capital += bet # Win case: increase capital by bet amount else: capital -= bet # Loss case: decrease capital by bet amount if capital <= 0: # Stop if capital is lost break return capital # Simulating different bet amounts from 100,000 to 10,000,000 KRW bet_amounts = np.arange(100000, 10000001, 100000) # From 100,000 to 10,000,000 in steps of 100,000 final_capitals = [] # Simulate for each bet amount and store the final capital after 1000 games for bet in bet_amounts: final_capital = simulate_betting(initial_capital, bet, win_probability_new, num_games) final_capitals.append(final_capital) # Plotting the results plt.figure(figsize=(10, 6)) plt.plot(bet_amounts, final_capitals, marker='o') plt.title("Final Capital After 1000 Games with Different Bet Sizes") plt.xlabel("Bet Amount (KRW)") plt.ylabel("Final Capital (KRW)") plt.grid(True) plt.show() |