import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
hero_stats = pd.read_csv('hero_play_stats.csv')
hero_stats
hero_stats['total_games_daily'] = np.ceil(hero_stats['total_games_daily'])
hero_stats['adj_guide_games_daily'] = np.ceil(hero_stats['adj_guide_games_daily'])
hero_stats['adj_guide_games_daily'].sum() / hero_stats['total_games_daily'].sum()
hero_stats['total_games_pct'] = hero_stats['total_games_daily'] / hero_stats['total_games_daily'].sum()
hero_stats['guide_games_pct'] = hero_stats['adj_guide_games_daily'] / hero_stats['total_games_daily']
hero_stats
team_temp = hero_stats.sample(10, weights='total_games_pct')
team_temp['prob'] = np.random.rand(10)
team_temp
(team_temp['prob'] < team_temp['guide_games_pct']).sum()
ttl_guide_counts = dict()
for i in range(100000):
team_temp = hero_stats.sample(10, weights='total_games_pct')
team_temp['prob'] = np.random.rand(10)
ttl_count = (team_temp['prob'] < team_temp['guide_games_pct']).sum()
ttl_guide_counts[ttl_count] = ttl_guide_counts.get(ttl_count, 0) + 1
ttl_guide_counts
x, y = zip(*sorted(ttl_guide_counts.items()))
y = [n/100000. for n in y]
plt.figure(figsize=(12,9))
plt.title('Monte Carlo Simulation of Torte de Lini Guides Used in a Game', fontsize=24)
plt.xlabel('Number of Torte de Lini Guides Used in a Game', fontsize=18)
plt.ylabel('Percent', fontsize=18)
plt.bar(x, y)
for i, v in enumerate(y):
plt.text(i-.22, v+.005, str(round((v*100), 4)) + '%', fontweight='bold')
Given that we know that how many games are played daily, how many games are played for each hero, and how many games for a specific hero use a Torte de Lini guide by day, we can then get an estimate of how many games have at least one person using a Torte de Lini guide.
This was calculated by using a Monte Carlo simulation method. While it could theoretically be calculated to exact precision given that we have the percents, there are a possible 81,572,506,886,508 possible team combinations, which is an unrealistic amount of calculations required for very little upside. The Monte Carlo simulation created teams of 10 different heroes, based on play rate and calculated the probability of that person using a guide given the numbers provided. This was then run 100,000 times and stored. Across multiple tests, the percents were fairly stable.
So the Monte Carlo simulation shows that roughly 17% of games have no one in the game using a guide, but in the other 83%, at least 1 person uses a guide, which is a pretty remarkable number.
To semi-validate this data, given the numbers we have, it seems like roughly 15% of all games use a Torte de Lini guide, which means that 85% of games do not. If we take that basic assumption given all heroes are picked equally, the probability of a game having no one using a guide is .85 ^ 10 or 19.68%. Not too far off from what our Monte Carlo simulation shows, so the results look fairly reasonable. So even though only 15% of games played on any individual hero us a Torte de Lini guide, the combined probability of among 10 people, at least 1 person using a guide is around 83%.
Some assumptions are made that are not representative of the real world. Heroes were selected at random, whereas more realistically, you would assume some level of team composition. There is also the assumption that players will use guides at random, whereas the truth is probably less skilled players use guides more often than skilled players. So realistically, more than 17% of games will have no one using a guide, but there is no better way to calculate this skill based guide usage.