**Tags**

**I. BACKGROUND**

Wind Runner is/was a popular Korean cell phone game that I recently got re-addicted to (now that I’ve abandoned Candy Crush). It’s a simple running game where you tap the screen to jump over obstacles and collect stars. You earn money (aka Gold) after each run, and you can use the gold to summon little pets, which help increase your score. ** Pets come in D, C, B, A, and S grades**; D grade pets are the least powerful, and S grade pets have the best benefits.

**To get higher grade pets, you combine 2 low-grade pets**. You combine 2 of the D-grade pets for a chance to get a C-grade pet; you combine 2 C-grade pets for a B-grade pet, etc. There is a fee for each combination attempt.

- D + D ⇒ C (you pay a fee of 200G to combine)
- C + C ⇒ B (fee is 1000G)
- B + B ⇒ A (fee is 2000G)
- A + A ⇒ S (fee is 5000G)

The tricky thing is that **combining pets don’t always succeed**. If it fails, then you lose 1 of the pets you offered up for sacrifice. You also don’t get a refund on the fee you paid for the failed combination.

To buy pets with in the first place, there are 2 options: You pay 2500G for 1 pet in the D~B grade. Or you pay 10,000G for 1 pet in the C~A grade. The first option is cheap but gets you lower grade pets, which means later you pay more to combine them for higher grade pets. The second option is 4 times as expensive, but you get higher grade pets to begin with. Then the question is, **which option is the more cost effective choice?**

**II. DATA COLLECTION**

The first thing I had to do was to figure out the probabilities of getting a certain grade pet, as well as the success rate for each combination.

Probabilities of Summoning a Certain Grade Pet – Option 1 (2500G/pet)

- D: 84/100 = 84%
- C: 14/100 = 14%
- B: 2/100 = 2%

Probabilities of Summoning a Certain Grade Pet – Option 2 (10,000G/pet)

- C: 77/100 = 77%
- B: 15/100 = 15%
- A: 8/100 = 8%

Combination Success Probabilities (p) & Fees (f)

- D + D ⇒ C: 75/99 ≈ 76% = p
_{c}(f_{c}= 200G) - C + C ⇒ B: 57/124 ≈ 46% = p
_{b}(f_{b}= 1000G) - B + B ⇒ A: 9/65 ≈ 14% = p
_{a}(f_{a}= 2000G) - A + A ⇒ S: 1/19 ≈ 5% = p
_{s}(f_{s}= 5000G)

**III. ANALYSIS**

Expected Costs

Let’s define some things:

- D = expected cost of a D-grade pet
- C = expected cost of a C-grade pet
- B = expected cost of a B-grade pet
- A = expected cost of an A-grade pet
- S = expected cost of an S-grade pet.

We don’t know D yet (we’ll calculate it later), but if we did, we can use it to calculate C.

Say we succeed combining two D pets in our 1st attempt. Then

C_{1} = 2D + f_{c}

because we spent two D pets and paid the fee f_{c}. This has a probability of succeeding equal to p_{c}.

Say we fail the 1st attempt and succeed in our 2nd attempt. Then

C_{2} = (2D + f_{c}) + (D + f_{c}).

The (2D + f_{c}) is for the successful attempt and (D + f_{c}) is for the failed attempt, since we lose only 1 of the D pets and pay the fee nonetheless. This has a success probability of p_{c}(1-p_{c}), since we must first fail (probability 1-p_{c}) and then succeed (probability p_{c}).

Say we fail 2 times and succeed in our 3rd attempt. Then

C_{3} = (2D + f_{c}) + 2(D + f_{c})

at probability p_{c}(1-p_{c})^{2}.

Now let’s combine all of these to find the “average” or expected cost of a C-grade pet:

C = (prob of success at 1st attempt)(cost1) + (prob of success at 2nd attempt)(cost2) + (prob of success at 3rd attempt)(cost3) + … forever and ever and ever and ever…

C = p_{c}(2D+f_{c}) + p_{c}(1-p_{c})[2D+f_{c}+(D+f_{c})] + p_{c}(1-p_{c})^{2}[2D+f_{c}+2(D+f_{c})] + …

…which simplifies to…

**C = [D(p _{c}+1)+f_{c}]/p_{c}.**

I add infinitely many numbers and somehow it equals this relatively simple thing?! How is this possible?! **By beautiful magic of mathematics!** I didn’t write out the work in case math scares you, but if you’re curious **check out the magic right here**.

Similarly, we can find that

- B = [C(p
_{b}+1)+f_{b}]/p_{b} - A = [B(p
_{a}+1)+f_{a}]/p_{a} - S = [A(p
_{s}+1)+f_{s}]/p_{s}.

This means that if I know D, I can solve for C, then solve for B, A, & S.

Calculating D – Option 1 (2500G/pet)

Recall from the DATA COLLECTION section that if I spend 2500G on a pet, I have 84% chance of getting a D-grade pet, 14% for a C-grade pet, and 2% for a B-grade pet. In other words,

2500 = 0.48D + 0.14C + 0.02B.

I have 3 variables, so I need 3 equations to solve this. I already know that

C = [D(p_{c}+1)+f_{c}]/p_{c}, and

B = [C(p_{b}+1)+f_{b}]/p_{b}.

I now have 3 equations, so I can solve this system of equation to get D, C, and B. Then I can easily solve for A and S as well (A = [B(p_{a}+1)+f_{a}]/p_{a} and S = [A(p_{s}+1)+f_{s}]/p_{s}).

You can** find the math here**, and the answers are (rounded to the nearest gold):

- D = 1,831G
- C = 4,512G
- B = 16,505G
- A = 150,148G
- S = 3,097,963G

Calculating C – Option 2 (10,000G/pet)

I solve this part in the exact same way, except I use these 3 equations:

10000 = 0.77C + 0.15B + 0.08A,

B = [C(p_{b}+1)+f_{b}]/p_{b}, and

A = [B(p_{a}+1)+f_{a}]/p_{a}.

You can** find the math here**, and the answers are (rounded to the nearest gold):

- D2 = undefined
- C2 = 2,125G
- B2 = 8,924G
- A2 = 87,816G
- S2 = 1,851,314G

Checking Answers with a Computer

To confirm my math, I wrote a simple python code that you can **download here**. It basically uses the eternally long version of C equation but only adds up the first n=1000 terms. The accuracy of the code depends on parameter values and values of D and C2 I found earlier. Hopefully I didn’t make any mistakes.

If you run the code, it gives me the exact same numbers as my math did. Check!

**IV. CONCLUSION AND REMARKS**

Comparing the expected costs for each grade of pets, it is clear that **Option 2 (10,000G/pet) is the more cost-efficient choice**. On average, Option 2 should be almost half as costly as Option 1. Although there are rooms for error in my data so that my parameter values are slightly off, the cost difference between Option 1 and 2 are so big that most likely Option 2 will be the winner.

This post has been cool in many ways. First, it demonstrated that **math can be used to describe all sorts of things around us** (like cell phone games), and that it can help solve problems that lead to efficient choices. Additionally, it was fun to find a solution when I wasn’t exactly sure how to go about doing it in the beginning. It was an unexpected surprise to use converging series (and somehow find on Wikipedia the formula that I needed). Lastly, having a computer program to confirm your answer is also pretty nice.

Ah such feeling of nerdy fulfillment!

Simeon Koh

P.S. This was a long post. Congratulations if you read it through. Even more congratulations if you at least looked at the math too.