ac-nh-turnip-prices icon indicating copy to clipboard operation
ac-nh-turnip-prices copied to clipboard

100% small spike to 100% decrease

Open Duckbill615 opened this issue 4 years ago • 4 comments

Hello. Thank you for this tool but with this afternoon's price, my prediction has been completely changed. I am the only one on the island, all prices are from my island, there has been no time traveling, and all prices are correct.

Thursday am:https://turnipprophet.io?prices=97.82.79.74.70.67.63.58..... Thursday PM:https://turnipprophet.io?prices=97.82.79.74.70.67.63.58.55....

Duckbill615 avatar Apr 30 '20 19:04 Duckbill615

It appears as though your Monday AM value of 82 is the root cause of the issue here.

Some necessary context: The sell price for any period is your Sunday buy price, known as basePrice multiplied by a given rate where the rate has a random chance element. The result of that is passed into an intceil() function which adds 0.9999 and then truncates the floating point down to a whole number.

With that out of the way, for a Decreasing pattern, the first period's rate is guaranteed to be between 0.85 - 0.9, based on this code extracted from the game.

rate = 0.9;
rate -= randfloat(0, 0.05);

Then, if we assume the worst possible random chance, we get the lowest rate of 0.85 and we multiply your base price against that value.

97 * 0.85 = 82.45‬

Finally, we pass the result into intceil() to get the final price value.

intceil(82.45)
82.45 + 0.99999 = 83.44999
(int) 83.44999 = 83

What this tells us is that for a buy price of 97, the lowest possible value for a Decreasing pattern is 83, making the 82 you received out of range, which means if the value is correct your pattern cannot be Decreasing.

There is only one other pattern that could possibly have as many consistent decreases before eventually spiking, and that is Small Spike, which has an opening range between 0.4 - 0.9, as seen in this code from the game:

rate = randfloat(0.9, 0.4);

However, for a Small Spike, the Thursday PM period is the last possible start of the spike, and when your value came in lower again, that made it impossible for Small Spike to be your pattern.

At this point, Turnip Prophet has determined there are no possible patterns for your values at all, and so it went over all the patterns again but this time with a fudge factor of 1, effectively increasing the possible ranges by 1 on the lower & upper bounds and as a result making your 82 on Monday AM appear as an acceptible value, even though by the game's math it is not possible.

Now, for why you ended up seeing a Decreasing pattern show up in the end - that's an unfortunate side effect of the fudge-factor that Turnip Prophet adds when it cannot find a valid pattern.

If you remove the Monday AM value of 82, the rest of your week results in a Decreasing prediction. https://turnipprophet.io?prices=97..79.74.70.67.63.58.55

So this begs a few questions:

  1. Are you confident the values were entered exactly correctly?
  2. Is every value, included the buy price, from the same island?
  3. Are you certain absolutely no time traveling was done this week?

theRTC204 avatar Apr 30 '20 22:04 theRTC204

Thank you for such a thorough explanation.

  1. I have been keeping a written log this week in order to track and am 99.9% certain of my accuracy
  2. All values are from the same island including the buy.
  3. I do not time travel as a part of my play style and am the only one with access to my switch

Duckbill615 avatar Apr 30 '20 23:04 Duckbill615

Ok, thanks for the detail here.

Something I hadn't mentioned previously was why we have the fudge factor in the first place.

When it comes to math in computing, floating point (not whole numbers) math is one of the most troublesome areas. CPUs from different architecture (x86, or ARM for example) can have slightly different results. Furthermore, programming languages can also have differences in how they handle the same math.

Essentially it's impossible to guarantee the exact result at all times unless your environment is identical, which ours is not.

The game runs on an ARM based CPU and the game is written in C++, while this tool runs on (probably) an x86 CPU, and is written in JavaScript.

If you are absolutely certain of those details, it is definitely possible that the Monday 82 was a rounding difference between the game on a Switch and this app, but I have to be honest that's an extremely rare or unlikely chance.

In any case, if it is a rounding issue, then sadly there's not really much we can do about it.

We have talked about putting messages on the site that appear when the fudge factor is applied, to give people a better sense of the fact that the numbers could be off. At least in that case you would have known to not take the result as gospel.

theRTC204 avatar May 01 '20 12:05 theRTC204

I had the same situation this week. This was the situation before this afternoon: https://turnipprophet.io/?prices=115.96.92.87.83.78.72.68..... A 100% small spike

And this was the situation after this afternoon: https://turnipprophet.io/?prices=115.96.92.87.83.78.72.68.63.... A 100% decrease, same as OP.

I have not time-traveled this week, have only bought on my island, am sure of the prices, and nobody visited my island (if that's relevant).

RensOliemans avatar Dec 10 '20 11:12 RensOliemans