Wikipedia:Reference desk/Archives/Mathematics/2021 June 3

From Wikipedia, the free encyclopedia
Mathematics desk
< June 2 << May | June | Jul >> June 4 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 3[edit]

Wordscapes prize[edit]

This sounds like a homework question, but I promise it's been a long time since high school for me. :) I'm curious to figure out the expected average time it will take (in games played) to obtain a "grand prize" in the game Wordscapes. They periodically run challenges to obtain cute little avatars and I'm wondering about the time commitment. I'll detail the setup from the top down:

  • There is a grand prize avatar you get by first obtaining...
  • All 12 base prizes which you can get by obtaining...
  • 3 "pieces" of the base prize. The 3 "pieces" are not distinct; you just need 3 "foxes" to get the fox or 3 "pagodas" to get the pagoda, not specifically piece 1 of 3, 2 of 3, and 3 of 3
  • You get two random "pieces" for every prize box you get by obtaining...
  • 10 "tokens" that you get by completing the Wordscapes puzzles. Each puzzle gives you 2 or 3 tokens, depending on the size of the puzzle. I don't know what the ratio of puzzles is and it probably varies, but as a ballpark maybe 2/3 or 3/4 puzzles give you 2 tokens upon completion.

So, to work it the other way: every four or five games, you'll be able to accumulate 10 tokens to exchange for 1 prize box which gives you 2 random prize pieces that belong to one of 12 prizes and once you've completed all 12 prizes you get the grand prize. One more twist: when you open the prize box, any pieces you can't use are put towards another bonus counter: every six pieces you get which you don't need gives you another random piece. If you don't need it, it also gets counted towards the same counter.
My question is: if we assume that the game is fair and random, how many games would it take to win? On average, of course; the contests are time restricted and you are not guaranteed of getting some piece you really want in a reasonable time frame. On the other hand, if you're extraordinarily lucky, you could theoretically win in about 80 games (80 games would get you ~18 prize boxes which would get you 36 prize "pieces", which could conceivably fill all 12 base prizes). However, I am not that lucky. Matt Deres (talk) 18:45, 3 June 2021 (UTC)[reply]

If I'm reading the problem correctly, the upshot is that you need 3 each of 12 possible prize pieces. If you know the expected number of pieces to collect to get them, say E, then multiply that by 10/2=5 to get the expected number of tokens. (Note that this is Expected value, the average number; it may or may not be a good estimate of the actual number on a particular instance.) The number of tokens per game seems uncertain, but it sounds like 2.5 per puzzle is a reasonable guess. That means the expected number of puzzles needed is E⋅5/2.5 = 2E puzzles.
So the real problem is to compute E(12,3) where E(n,k) is the number of random pieces from a set of n you need to collect before you get k each of all n. E(n,1) is the well-known and well-solved Coupon collector's problem. E(n,k) is a variation solved asymptotically by Donald J. Newman and Lawrence Shepp. (See the second bullet in the "Extensions and generalizations" section.) It's obvious that E(n,0) = 0, and somewhat less obvious that E(n,1) = n Hn where Hn is the nth Harmonic number.
It shouldn't be too difficult to compute the exact value of E(12,3) with a bit of programming skill and a moderate amount of computing time. Let g(a0, a1, a2, a3) be the expected number of pieces needed when you are missing 0 in a0 types, 1 in a1 types, 2 in a2 types, and 3 in a3 types, where a0+a1+a2+a3=n, the total number of types. Then E(n,0)=0=g(n,0,0,0); E(n,1)=g(0,n,0,0); E(n,2)=g(0,0,n,0); E(n,3)=g(0,0,0,n). Then I believe you can compute g via the following recursion:
You could probably get a good approximation with less programming and more computer time via a Monte Carlo method. It might be worthwhile to do both and compare the results.
This is assuming that the pieces are equally distributed. If one of the pieces is rarer than the others then it's really the only one that counts since the chances are you will collect all you need of the other other pieces before getting all the rare ones you need. (I believe it's common in this kind of collection game, especially when there are large prizes involved, to pick one critical piece/coupon, and limit the number given out. In effect, this limits the number of large prizes given away.) I'm also assuming there is no trading between players or trading extra pieces for additional tokens or prize boxes; that would make the process more interesting but also the analysis much more difficult. --RDBury (talk) 08:43, 4 June 2021 (UTC)[reply]
(ec) If I understand the rules correctly, the concept of a "prize box" is not relevant for the question; all that matters is that 10 tokens are changed into 2 pieces. I take it that if a player holding 2 fox pieces and 2 pag pieces changes 10 tokens into 2 random pieces that turn out to be a fox piece and a pag piece, they can now change their 3 fox pieces for a fox prize and their 3 pag pieces for a pag prize, in the same round. Also, I assume that when a player "can't use" some piece, this is because they already have the corresponding prize. I also assume a player can't or won't hoard unusable pieces; otherwise, they might theoretically obtain 2 grand prizes. However, even if allowed, hoarding has to be a bad strategy. So I assume any 6 unusable pieced are changed into 1 random piece without delay. It should be possible to calculate the exact expected value, given the probability of getting 2 pieces in return, but here are the results of a Monte Carlo simulation, run for varying probabilities until 10,000 grand prize wins. The first column is the 2-piece probability, the second the average number of rounds needed.
        p    ng
       0.0 118.7306
       0.1 122.8137
       0.2 127.2175
       0.3 131.6600
       0.4 136.8052
       0.5 141.7994
       0.6 148.1097
       0.7 153.8639
       0.8 161.1391
       0.9 168.8848
       1.0 176.5770

Using the expected number of pieces np obtained for 10 tokens, where np = 3 − p, we can also tabulate ng×np:

       np   ng×np
       2.0 353.15
       2.1 354.66
       2.2 354.51
       2.3 353.89
       2.4 355.46
       2.5 354.50
       2.6 355.69
       2.7 355.48
       2.8 356.21
       2.9 356.16
       3.0 356.19
So ng ≈ 355/np.  --Lambiam 09:57, 4 June 2021 (UTC)[reply]
Whoa! I had a feeling this was going to be complex, but had no idea what kinds of detail were possible. I'll clear up a few questions from above:
  • The "grand prize" is worth nothing - it's a cute picture - so Wordscapes has no direct monetary incentive to limit prizes. I'm not winning a Toyota - or even a toy Yoda.
  • If it matters, there are no direct finances involved at all; there's no gambling or competition with other players in any way. You play games and get cutesy pictures to use as avatars, nothing more. I keep using "no direct" here because there is always the indirect incentive to get more people playing (= more downloads) and playing a lot (= more adverts or incentive to buy the full game, which I did years ago).
  • There is no swapping between players or hoarding. When you open the prize box, any pieces you need get added to your set and any you don't need get added to the bonus counter I described in the OP's second to last paragraph.
  • Is the distribution of pieces random and fair (i.e. balanced)? I don't know; in part, that's what I'm curious about. There's always going to be outliers - the very lucky and very unlucky - but at what number of games played does it become suspicious? As a blanket statement, humans are terrible at statistics, especially those they're personally involved in, and I'm no exception. My experience is that it's taking longer than I feel it ought to, but I know my perspective is limited. Thank you both for your help thus far! Matt Deres (talk) 12:49, 4 June 2021 (UTC)[reply]