Selling Turnips in Animal Crossing, the Secretary Problem and Normal Distributions

Leonardo Dipilato
8 min readApr 3, 2020

--

Recently, I picked up Animal Crossing: New Horizons, the latest Animal Crossing game for the Nintendo Switch. It’s my first Animal Crossing game and I went in blind, trying to stay as spoiler-free as possible. Although this article isn’t about Animal Crossing, a bit of introduction is needed. Skip the next paragraph if you are familiar with the series.

Animal Crossing is, more or less, a life simulation. It’s not a realistic simulation, but it’s a relaxing experience. In Animal Crossing: New Horizons you get dropped in a desert island and you need to populate it, decorate it and much more. You can fish, catch bugs, cut trees and much more for the sole purpose of gaining bells, the game’s currency, to repay the loans you’ll take to build your house and to buy extra furniture to use as decorations. The game uses real-time events where a day in the game is a day in real life, with the clock and the day of the year perfectly aligned with real life.

On Sunday mornings, Daisy Mae visits your island. Daisy Mae sells you her turnips, letting you partecipate in what’s called the stalk market (a clear pun on stock market)

The store will explain how the stalk market ACTUALLY works. Every day, except on Sundays, the store will offer a certain amount of bells for your turnips. This price changes twice per day, so you get a different price on the morning and on the evening of every day. This means that, in a week (Monday to Saturday) you have a grand total of 6x2=12 total prices you can potentially sell your turnips at.

This looks great, at first, but when you look into that, it’s no more than stock marketing: let’s say you buy turnips at 90 bells and, on Monday morning, the store sets the price at 120. That’s a profit if you sell your turnips right then, but is it the best you can do?

The store never explains to you in what range the prices can vary, and how likely it is for every price to appear, so as far as you know, 120 bells might even be the lowest price and by waiting you could sell them at 1,000 or 10,000. You have absolutely no way of knowing beforehand.

As a first-timer at Animal Crossing, I was facing a dilemma: Monday morning had me at 100, while the evening shifted at 120. Should I sell? Should I not?

Thankfully, I’m a bit of a statistician, and the stalk market made me remember something: the Secretary Problem.

The Secretary Problem is a problem in statistics which can be explained as follows:

Your company is looking for a new secretary to hire, so you are holding interviews. There are N applicants for the job, and you can interview them one by one. However, you need to tell the interviewee if they are hired or rejected immediately, so once an applicant’s interview is over, they are either in the company, or you lost them forever.

To help you in your screening, however, you have a rigorous set of questions to ask with a rigorous scoring system. The score can go from minus infinity to plus infinity, but it lets you compare two applicants in a precise and objective way.

Your objective is devising a strategy that hires the best secretary with a good probability.

I always thought that the premise of the Secretary Problem was a bit verbous to explain and quite strange (why wouldn’t I be able to call back an applicant AFTER the interview? Why is there no maximum score?), but the Stalk Market definitely makes more sense, doesn’t it?

So, how does one go about solving this kind of problems?

Well, first of all, let’s interview our first applicant. No matter their score, we definitely cannot pick them: whether it is 100, 1,000, 10,000, if we cannot compare their score to anyone else’s, the score is meaningless. This is a forced rejection.

Then, we get to the second applicant: their score, now, is comparable to the previous applicant, and we can at least know who’s better and who’s worse. However, again, it doesn’t matter how much better the second applicant is (ten times the first one? a hundred times?), we still have no idea whether the second one is a hundred times better because the first one was incredibly bad or because they REALLY are that good. So this is a forced rejection, too.

With the third applicant, we can now start understanding how the scoring works: sure, all of the applicants until now could be outliers, much better or much worse than the average, but the more applicants we interview, the less it is probable for all of them to be outliers.

This sparks an idea: what if we interviewed a ton of them to estimate what the average applicant looks like and then hire someone who’s better than average? This feels like a great idea.

So, many of us know what “average” means: if we sum the scores of all the applicants and then divide by the number of the applicants what we get is the average score. To be precise, if we interviewed EVERY secretary all over the world, including those who didn’t apply, we’d get the average score on our test for all the secretaries. However, the applicants are only a subset of all the secretaries in the world, so what we get is an empirical estimation of the average score. This is a mouthful, so we’ll just say “average”.

Now it’s time for “what-if”s: what if every secretary scores between 39 and 41 with an average of 40? Is that different from scoring between 20 and 60 with an average of 40?

Well, let’s say you got the first scenario. If someone showed up with a score of 42 they’d be your best applicant yet and you’d hire them with your eyes closed, right?

In the second scenario, however, many of those you already interviewed are a lot better, almost twice as much, so you’d really be hiring a mediocre, “average” secretary.

What is the difference between those scenarios? Intuitively, you know that the average for the first two cases is the same, but the spread is different, so it’s not as awesome to be 2 points better than average in a case as much as it is in the other.

Enter Gaussian Distributions.

Gaussian Distributions (or Normal Distributions) are a really useful model that can be used to approximate many statistical distributions. There are great articles around the internet that explain Gaussian Distributions, but, roughly speaking: a Gaussian Distribution is a set of probability values such that you can control the average value of the samples as well as how far they usually are from the average.

I’m sure some examples will explain it much better:

Here, I “interviewed” 100 people. The average (mu in the title of the plot) is a bit higher than 40, but close enough. std, instead, is called the standard deviation, and it means “how much is it normal to deviate from the average?”. Again, it’s better explained with an example:

This time, the standard deviation is 9.48, which means that the values are more “spread out” than the case from before. If those were results of a test and you scored 50, that’d be better than average, but actually not impressive. If, in the previous example, you scored 50, you’d be way better than everyone who took the exam before you, so that’s great!

So, if you have N applicants and you interview M of them to estimate a Gaussian Distribution (by finding mu and std), you can immediately know how good a new applicant is in relation to the others. On the other hand, if M is too small, the same test can give very different values of mu and std.

For example, these two tests are the same test (generated with mu = 40 and std = 2.5), but the results were quite different (42, 2 as opposed to 40, 3.15).

So, the real question is “how do I pick M?”.

Ideally, M = N would be the best approximation you can afford. However, if you do that, you’d have rejected all the applicants and hired no one, possibly getting you fired.

For small values of M, instead, you may pick sub-optimal applicants.

Luckily, the Secretary Problem is well-known, and people around the world have found solutions to it. The proof is quite math-heavy, so we’ll leave it out, only looking at the results.

The trick is rejecting the first N/e applicants, where e is Euler’s number (approximately 37% of the applicants) and then picking the applicant that’s better than every other candidate seen before.

This strategy will let us pick the best applicant 37% of the time, which is incredibly high if we consider that we knew almost nothing about what a good secretary looks like before starting out.

In this plot you can see I ran 30 simulations. Every simulation has a best applicant and a chosen applicant. In blue you see the best applicant’s score, in orange you see the chosen applicant’s score and in green you see the chosen applicant’s score when they were also the best choice. In this specific set of simulations, the best applicant was chosen 37% of the times, which is pretty neat.

Going back to our stalk market, this means that if you want to go spoiler-free (without knowing the average price and standard deviation of turnips), the best way to go about it is waiting for N/e = 12/e ≈ 5 price changes (so Monday morning and evening, Tuesday morning and evening and Wednesday morning), recording the best price you get these days and then, starting from Wednesday evening you’ll need to pick up the first best price.

However, keep in mind that this strategy works for when you have no idea of how the Stalk Market works: while you get experience with the game, you’ll learn to understand intuitively what the average prices are, and you’ll get an even better likelyhood to fetch a good profit for your efforts!

It’s fun when high-level math is used to be good at a PEGI 3 game, isn’t it?

Thanks for reading through the whole post: I hope it wasn’t too difficult to follow and that it was somehow educational. If you feel like it, leave me some feedback on how to improve my article writing!

--

--

Leonardo Dipilato

Design Engineer @ Cubit, Community Lead @ GDG Pisa, Child @ Heart