Skip to content

Instantly share code, notes, and snippets.

@tallpeak
Last active April 8, 2024 12:51
Show Gist options
  • Save tallpeak/64e223df5a122b226d5a76d5657af60d to your computer and use it in GitHub Desktop.
Save tallpeak/64e223df5a122b226d5a76d5657af60d to your computer and use it in GitHub Desktop.
estimate cost of an in-game item ("Strength Upgrades" in Lumberjack Heroes in Fortnite)
# A program to estimate the formula for cost of an in-game item;
# Specifically, "Strength Upgrades" in Lumberjack Heroes in Fortnite
# https://chat.openai.com/c/e8e7f768-e9d7-4553-94aa-4e9b5b12d917
# count,cost
# 1,55.8E45
# 10,1.13E48
# 100,11.5E51
counts = [1, 10, 100]
costs = [55.8E45, 1.13E48, 11.5E51]
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
# Exponential function
def exponential_function(x, a, b):
return a * np.exp(b * x)
a = 79.18318938403567
b = 1.1550242275702656
# Generate points for the exponential curve
x_curve = np.linspace(1, 100, 100)
y_curve = exponential_function(x_curve, a, b)
# Plotting the original data
plt.scatter(counts, costs, label='Data')
# Plotting the regression curve
plt.plot(x_curve, y_curve, 'r', label='Exponential Regression')
plt.xlabel('Count')
plt.ylabel('Cost')
plt.title('Exponential Regression')
plt.legend()
plt.grid(True)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment