Skip to content

Comments

Implement Expected Value Calculations#592

Open
t1an-xyz wants to merge 3 commits intomikebryant:masterfrom
t1an-xyz:expected-values
Open

Implement Expected Value Calculations#592
t1an-xyz wants to merge 3 commits intomikebryant:masterfrom
t1an-xyz:expected-values

Conversation

@t1an-xyz
Copy link

@t1an-xyz t1an-xyz commented Dec 17, 2025

Summary

Adds expected value calculations to help users decide when to sell turnips. Fixes issue #329.

Changes

  • Calculate expected prices for each time slot based on pattern probabilities
  • Display "Should you sell now?" recommendation with expected maximum
  • Add "Expected Price" line to the chart
  • New translation keys in locales/en.json

Translation keys needing community translation

  • output.chart.expected
  • output.sell-now-title, output.sell-now, output.sell-later, output.sell-advice
  • output.should-buy-title, output.should-buy, output.should-not-buy, output.buy-advice

How it works

The expected value for time slot $i$ can be calculated using the formula

$$ \mathbb E[X_i] = \sum_{z\in\mathcal Z} P(Z=z) \mathbb E[X_i|Z=z] $$

where $z$ is the pattern and $\mathbb E[X_i|Z=z]$ is the expected price at time slot $i$ given the current pattern is $z$. Since $X_i$ follows a uniform distribution, $X_i = \frac{a+b}{2}$ is simply the average of the min and max at time slot $i$ given pattern $z$.

The tool recommends selling now if the current price is greater than or equal to the expected maximum price of holding the item and selling later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant