import numpy as np
def calculate_gems_and_experience(experience_sapphire, experience_emerald, experience_ruby, new_total_experience, bonus_multiplier=None):
if bonus_multiplier:
experience_sapphire_bonus = experience_sapphire * bonus_multiplier
experience_emerald_bonus = experience_emerald * bonus_multiplier
experience_ruby_bonus = experience_ruby * bonus_multiplier
else:
experience_sapphire_bonus = experience_sapphire
experience_emerald_bonus = experience_emerald
experience_ruby_bonus = experience_ruby
# Ratios based on probabilities: Sapphire 50%, Emerald 30.03%, Ruby 20%
gem_ratios = np.array([2.5, 1.5015, 1]) # Scaled to match the smallest ratio (Ruby = 1)
# Recalculate the weighted experience per unit with the ratios
experience_per_unit = sum(
gem_ratios * [experience_sapphire_bonus, experience_emerald_bonus, experience_ruby_bonus]
)
# Calculate the multiplier to determine the number of gems needed
multiplier = new_total_experience / experience_per_unit
# Calculate the approximate number of gems of each type using the ratios
required_sapphires = round(gem_ratios[0] * multiplier)
required_emeralds = round(gem_ratios[1] * multiplier)
required_rubies = round(gem_ratios[2] * multiplier)
# Calculate the total experience from this combination
total_experience_gained = (
required_sapphires * experience_sapphire_bonus +
required_emeralds * experience_emerald_bonus +
required_rubies * experience_ruby_bonus
)
return required_sapphires, required_emeralds, required_rubies, total_experience_gained
def main():
# Constants for experience per action for each gem
experience_sapphire = 50
experience_emerald = 67.5
experience_ruby = 85
# Total experience needed
new_total_experience = 1462010
# Adjusted experience per gem with 2.5% bonus
bonus_multiplier = 1.025
# Calculate with bonus multiplier
sapphires_with_bonus, emeralds_with_bonus, rubies_with_bonus, experience_with_bonus = calculate_gems_and_experience(
experience_sapphire, experience_emerald, experience_ruby, new_total_experience, bonus_multiplier
)
# Calculate without bonus multiplier
sapphires_without_bonus, emeralds_without_bonus, rubies_without_bonus, experience_without_bonus = calculate_gems_and_experience(
experience_sapphire, experience_emerald, experience_ruby, new_total_experience
)
print(f'With Wisdom Aura:\n Sapphires Needed: {sapphires_with_bonus:,}\n Emeralds Needed: {emeralds_with_bonus:,}\n Rubies Needed: {rubies_with_bonus:,}\n Total Experience Gained: {experience_with_bonus:,}\n')
print(f'Without Wisdom Aura:\n Sapphires Needed: {sapphires_without_bonus:,}\n Emeralds Needed: {emeralds_without_bonus:,}\n Rubies Needed: {rubies_without_bonus:,}\n Total Experience Gained: {experience_without_bonus:,}')
main() Click Run or press shift + ENTER to run code