1

This is a problem I've been thinking about for a few months. It was created by Kyle Hess, inspired from playing the game Pocket Frogs.

OP's PROBLEM STATEMENT:

https://i.stack.imgur.com/wvccF.jpg

"I’m playing pocket frogs. Roughly speaking, each frog’s type is determined by a primary and secondary color, of which there are 16 varieties. Thus, there are 256 frog types. You can breed two frogs together to get a 1/4 chance of receiving any of their given mixes. For example, breeding a brown/black frog with a black/yellow frog gives equal chances for brown/yellow, brown/black, black/black, and black/yellow. You can also buy a random frog from the store (you don’t get to see or choose the frog before you buy it).

Let’s say breeding two frogs costs \$1 and buying a random new frog costs \$5. How much money do you spend on average if you strategically breed/buy frogs to minimize the amount you spend?

[Goal (end game) is to collect all frogs. You initially start with 0 collected frogs. All frogs can breed with eachother.] "

==================================

CONTEXT AND CLARIFICATION:

I haven't actually played Pocket Frogs, and OP's specifically stated problem is what I'm trying to solve.

My verified-by-OP understanding of how frog breeding works in this problem:

If two chosen parent frogs have the same primary color, or have the same secondary color, then breeding them cannot give a new different frog. Only when [their primaries are different AND their secondaries are different] then there is at-best a 50% chance of getting a 'new' frog (different from the two you started with).

If you have two frogs F11=P1S1 and F22=P2S2 (where P1 =/= P2 and S1 =/= S2), then breeding this pair will give you a 50% chance of getting a frog you started with, and a 50% (25% + 25%) chance of getting either of the 'new' frogs F12=P1S2 or F21=P2S1.

Similarly if you start with the frogs F12 and F21, then breeding these frogs gives you a 50% chance at getting either of the 'new' frogs F11 or F22. You want to avoid the situation where you already have one or both of these 'new' frogs, relative to the two parent frogs you started with.

================================

SHOWING MY WORK:

ASSUMPTIONS:

I'm working with the assumption (probability/stats and infinite games are not my strongest skill), that while it is conceivably possible the game could be played indefinitely (wow you must really have terrible frog-purchasing luck), there is still a computable and precisely exact answer to a question of the form 'when do you expect (and thus how much money do you expect to spend using X strategy) to collect all 256 frogs?'.

If this fundamental assumption about the existence of one unique computeable exact answer, is incorrect, then please let me know.

Of course, please also correct me if my proposed strategy is flawed or insufficient, if the problem is not well defined, or if the problem does not have one exact unique answer without further clarification.

PROPOSED GAMEPLAY STRATEGY:

Assumming the player uses the consecutive two-part strategy below (1. then 2.), I think using this strategy and solving both of these parts together, is sufficient for solving OP's question.

Part 1.

The immediate goal is to buy enough individual frogs at-random until you have a collection which contains all 16 primary colors AND all 16 secondary colors. For example, 14 monochromatic frogs and 2 frogs with swapped primary and secondary colors.

The initial moment this (let's call it 'breedable') set is created, only then may the player never need to buy a random frog again (and still be able to collect all 256 frogs).

A set of previously-collected frogs satisfying this breedable condition, is achieveable ideally with a minimum of 16 frogs (random purchases), and it is guaranteed to be achieved (via pigeon-hole principle) when you've collected (by any means) 16*16-16+1=241 distinct frogs.

Starting with 0 frogs and ONLY buying random frogs, how many random frogs do you expect to buy before initially creating a breedable set?

Part 2.

The first moment you've formed a breedable set, never buy a random frog again. Now you should selectively breed all the remaining frogs you haven't already collected.

This should be achieved by first going through all breeding pairs which have a 50% chance to produce (one of two possible) new frog(s), then going through all breeding pairs which have a 25% chance to produce (the last remaining possible) new frog for a given pair of parents. Note that when any specific 50% chance pair is bred successfully (produces a new previously-uncollected child frog), that same parent pair will get transformed into a 25% chance pair.)

==================================

PREVIOUS HELP RECIEVED (for Part 1.):

I don't want to spam online communities by asking multiple loosley-related questions in an attempt to solve disjoint pieces of this problem by myself. So I want consolidate all of my efforts, and show the full scope of the original Pocket Frogs problem.

I tried posting the first part of the question (Part 1.) on r/MathHelp, reformulated as a selecting-balls-from-bins question. Some users have already given me some great responses to this question.

https://www.reddit.com/r/MathHelp/comments/xcns6i/coupon_collectors_problem_expected_time_to_win/

Based on previously-recieved help from my balls-and-bins question, I think this might be the generalized solution to Part1?

Expected number of times a set of 10 integers (selected from 1-100) is selected before all 100 are seen

Where n = number of coupons = 16 primary colors + 16 secondary colors = 32, and m = number of distinct coupons drawn per group = 2 (= 1 primary + 1 secondary)?

If my understanding is correct, then we can expect to repeat purchasing random frogs one-at-a-time, approximately 64.155113 times, until it's expected we have first created a breedable set of frogs.

https://www.wolframalpha.com/input?i=sum_j%3D1%5E32+%5B+%28-1%29%5E%28j-1%29++%2832+choose+j%29++1%2F%281-+%28%2832-j%29+choose+2%29%2F%2832+choose+2%29+%29+%5D

https://i.stack.imgur.com/hYJhU.jpg

==================================

ATTEMPT AT A SIMULATED SOLUTION:

One of my friends even started writing a python script to help try to find a simulated solution to this question! I don't believe it's 'complete' but it should compile; feel free to check it out!

https://pastebin.com/aqNKKnXL

==================================

BONUS BRAINSTORMING:

In a humorous attempt to better understand this problem-space in general I was inspired as a self-exercise to create this (potentially not very helpful and convoluted (no pun intended)) problem: https://i.stack.imgur.com/23tUb.jpg

Again, I'm only requesting help solving OP's stated problem.

Thank you again so much to any and everyone for your time, energy, and support, towards solving this problem!

EDIT: I have also cross-posted this problem to r/learnmath: https://www.reddit.com/r/learnmath/comments/11fqi6s/a_pocket_frog_collection_problem/

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 02 '23 at 06:37
  • Can any two frogs be bred? Or do you have to consider the sex of the frogs? – paw88789 Mar 02 '23 at 13:06
  • @paw88789 Yes, any two frogs can breed together. Sex of the frogs isn't a property to consider. – Gtcarozzi Mar 02 '23 at 22:10
  • What are you actually asking? For a full solution? Whether the optimal strategy is of the form you describe? The expected cost in part 1? This is what joriki's answer deals with but it's not clear to me that this is so relevant since the distribution in part 2 seems conditional on the end state of part 1. How to conclude? – ronno Mar 03 '23 at 10:19

1 Answers1

1

I’ll answer the coupon collector’s part of the question: How long does it take to collect all primary and secondary colours?

The result you quote from my answer to the linked question is a very good approximation, but it’s not the exact answer to the present problem. This is because in that other problem any combination of two coupons can be drawn, whereas here the coupons are in two classes and you always draw one from each class.

You’re effectively making two separate and independent collections of $16$ coupons each, so the expected number of draws required is the expectation of the maximum of the expected numbers of draws required in two separate and independent collections of $16$ coupons.

The probability that one collection of $n$ coupons has been completed after $t$ draws is

$$ \sum_{j=0}^n(-1)^j\binom nj\left(1-\frac jn\right)^t\;, $$

so the probability that two collections have been completed is the square of that, and the expectation of the number $T$ of draws required is

\begin{eqnarray} E[T] &=& \sum_{t=0}^\infty P(T\gt t) \\ &=& \sum_{t=0}^\infty\left(1-\left(\sum_{j=0}^n(-1)^j\binom nj\left(1-\frac jn\right)^t\right)^2\right) \\ &=& \sum_{t=0}^\infty\sum_{(i,j)\ne(0,0)}(-1)^{i+j+1}\binom ni\binom nj\left(1-\frac in\right)^t\left(1-\frac jn\right)^t \\ &=& \sum_{(i,j)\ne(0,0)}(-1)^{i+j+1}\binom ni\binom nj\sum_{t=0}^\infty\left(1-\frac in\right)^t\left(1-\frac jn\right)^t \\ &=& \sum_{(i,j)\ne(0,0)}(-1)^{i+j+1}\binom ni\binom nj\frac1{1-\left(1-\frac in\right)\left(1-\frac jn\right)}\;. \end{eqnarray}

Here’s Java code that computes this sum and checks the result by also computing the expected number of draws using a Markov process on the collection states. The result is

$$ \frac{9795043989287388681752713304719019406040075271288152747501179303188302254251}{152787333124397446947286625215490174178523551680263634399918107432677775875}\\[8pt] \approx64.109\;, $$

so your approximation is only off by about $0.046$ draws.

joriki
  • 238,052