Turnip for the Books: Part I

How can we beat the Stalk Market in Animal Crossing: New Horizons?
Posted on Mar 29, 2020

Animal Crossing: New Horizons came out just over a week ago, and obviously it’s consumed a large amount of my time. Quarantine rules mean I can’t leave the house all that often, and if I’m honest I’m going a little bit stir crazy, so it’s been a nice distraction.

The game has a feature, humorously called the Stalk Market, which allows you to buy turnips from a travelling salesperson on Sunday morning, and sell them at any point during the next week at the shop on the island for a profit. Some additional things to note:

  • The price that the shop offers for turnips can vary a lot.
  • The price that the shop offers changes at 5am and 12pm each day, for a total of 12 different price points (the shop does not buy turnips on Sunday).
  • You have to sell turnips in the week after you buy them, otherwise they go rotten. You can still do certain things with rotten turnips, but they no longer sell for a lot.

This is, as the name Stalk Market might suggest, a very simple version of the stock market. So what should we do about it? How can we make the most profit off of it? Let’s model it.

Modelling the Stalk Market

Let’s start with some simplifying assumptions about how the market works, which we can relax later:

  1. The prices at each of the 12 points are independent of each other.
    • This is actually very likely not true, although I don’t have enough data to determine the pattern yet. In New Leaf the game would give you one of four patterns each week1; New Horizons might employ a similar policy but we don’t yet know.
  2. We’re doing this alone. That is, we have no friends to help us - if we did, then we essentially have two places that we can sell them, which means we can do a bit better.
  3. We have to sell all of our turnips at once.

Finding the High Point

Let’s say that we want to simply find the highest price that the turnips sell for. This is actually a very well studied problem, making the assumptions that we’ve made above. The area that this falls under is Optimal Stopping theory, specifically the Secretary Problem. I’m going to avoid duplicating a derivation here and give that we should use the Odds Algorithm to solve this problem (the three links given in this paragraph already provide an excellent rabbit hole for a bored self-isolator to jump down).

The Odds Algorithm specifies that:

  • We should find the stopping index, s, for our problem.
  • We should let the first s − 1 prices pass without selling turnips at those prices.
  • We should then sell at the first point where the price is higher than all of the prices that we’ve seen so far.

In the case of our problem, note that if the prices are independent (which we assume for now), then we have $P[i \textrm{ is the highest price so far}]=\frac{1}{i}$. Using the Odds Algorithm, we find that the stopping point s = 5. This means we should look at four prices, and then cash out at the first price that is higher than those first four. This gives us a lower bound of success (defined here as finding the high point at which to sell our turnips, as $\frac{1}{e} \approx 0.368\dots$, which is the best possible. In fact, the cases we have here are:

  • With probability $\sum_{i=s}^{12} \frac{1}{i-1} \cdot \prod_{i=s}^{12} \frac{i-1}{i} \approx 0.396\dots$, we have that we cash out our turnips at the best price.
  • With probability $\frac{1}{3}$, we have that the best price was in the first four prices presented, and we end up with the final price. In this case, our expected rank of the prices is that we get the price in 7th place.
  • With the remaining probability ( ≈ 0.271…), we have that we picked a price that was above the first four prices offered, but wasn’t the highest price. The maths gets a bit funky here, but we generally do quite well, getting the second or third best price.

There’s actually an interesting tradeoff if we use s = 4 instead. We lose some of the risk of just picking the price on Saturday afternoon (it becomes $\frac{1}{4}$), but we are also a tiny bit less likely to get the highest price (now  ≈ 0.380…). Given that our aim is actually to maximise expected profits (rather than simply maximise our chances of making the biggest possible profit), this tradeoff is probably worth it!

Cardinal Payoff

Is the tradeoff worth it? Let’s consider something a little more realistic. Say that the prices are uniformly distributed from [0..1], with payoff equal to the value selected. Bearden [2006]2 showed that the value of s we should use to maximise expected value is the integer value closest to $\sqrt{n}$. In the case of one player deciding when to cash out their turnips, this is (just about!) s = 3, so the tradeoff described above is actually good under this (admittedly simplified) model of maximising expected value, and in fact we should go even further, to s = 3.

Two Players

Let’s relax one of those assumptions we had earlier. My boyfriend also owns the game, so let’s say that we can check both of our prices at morning and afternoon. How likely are we to get the best price possible?

Well, naively, we can pretend that we can’t see both players values at once, and “view them sequentially”. Applying the Odds Algorithm again, we get a value of s = 10, a probability of getting the best price of $\approx \frac{1}{e}$ (this is the limit for the success probability), and a probability of $\frac{3}{8}$ of ending up with the last price on Saturday afternoon. That probability of ending up with something random is a bit high now, isn’t it? Applying Bearden’s cardinal maximisation result again, we should set s = 5 here, which is far lower. The gulf between maximising the probability of the best result and maximising expected value is super-constant, and only grows with higher n (s in the Odds Algorithm is $\approx \frac{n}{e}$).

Of course, this is about trying to find the best possible out of the 24 total prices offered. It’s likely (although again, with no concrete numbers it’s hard to back up) that this will result in at least one of the parties doing better than they would have on their own.

Even the naive multiplayer approach admits some very easy improvements (we always get the best of the two prices on Saturday afternoon, for example). However the analysis actually becomes quite thorny here, and it’s hard to make progress. It’s also not too worth it, partly because it’s near-optimal anyway, and partly because of how simplified the assumptions are, which brings me to my next point.

Conclusion and Part II

I didn’t deal with any actual currency numbers in this initial exploration (honestly it was mainly a chance for me to go nuts reading papers about optimal stopping theory). The main reason I didn’t was because without any good evidence on the numbers that the game gives you, discussion about exact payoff is pretty meaningless. In truth we don’t know whether the offers are normally distributed, beta distributed, uniformly distributed, or (most likely) dependent random variables that follow one of several fixed patterns. Working with random variables isn’t easy when you don’t have any idea how they’re distributed (and your sample size for testing the distribution is small, and it’s not likely to be an independent distribution anyway).

It’s probably going to be quite fun (and perhaps not too difficult) to do the maths on optimal trading strategies when we have a good idea of how the pricing RNG works. Obtaining this information removes our first assumption, and makes it easier to tackle the second one about good multiplayer strategies. The hardest thing to work out seems to be partial sale strategies, where you reduce your risk by selling some of your turnips off at a good profit. One initial idea I have is that you could sell off a certain percentage of your turnips any time the price is at a record high, but I’m not sure whether that will turn out to be a strong strategy.

I intend to investigate the numbers and write a follow up to this. If you’re interested then let me know and I can give you access to a spreadsheet where I’m keeping track of the turnip sale prices.

  1. Animal Crossing Wiki entry on Turnips

  2. Bearden, J.N., 2006. A new secretary problem with rank-based selection and cardinal payoffs. Journal of Mathematical Psychology, 50(1), pp.58-59.