Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Array
- def sum
- reduce(0, :+)
- end
- def avg
- sum.fdiv(size)
- end
- end
- def sr_diff
- sr = (18..23).to_a.sample
- if win?
- sr
- else
- sr * -1
- end
- end
- def win_rate
- 0.52
- end
- def win?
- percent = (win_rate * 100).round
- dice_roll = (0..100).to_a.sample
- dice_roll <= percent
- end
- def games_to_play_to_reach(goal:, start:)
- sr = start
- games_played = 0
- loop do
- games_played += 1
- sr += sr_diff
- break if sr >= goal
- end
- games_played
- end
- goal = 2600
- start = 2300
- number_of_games_played = 1_000.times.map do
- games_to_play_to_reach(goal: goal, start: start)
- end
- games = number_of_games_played.avg.round
- puts "You should expect to play #{games} games to each #{goal} SR, starting from #{start} with a winrate of #{(win_rate*100).round}%"
Add Comment
Please, Sign In to add comment