User:Jdavis/UVs
From SpiralKnights
This guide describes optimal strategies for obtaining unique variants (UVs) from Punch. It also tells you the expected cost of those UVs. The calculations boil down to basic probability theory combined with data collected by players.
Expected cost is a technical term of probability, but it's not hard to understand: It's the cost for a player experiencing average luck. Some players will get lucky and obtain UVs more cheaply than expected. Other players will get unlucky and spend much more than expected, or never get a good UV at all. If many players use Punch, and even the unluckiest players keep trying until they succeed, then the expected cost is the average of all of the players' costs.
Frequently players sell UVs for much lower prices than appear here. So you should always consider buying UVs rather than Punching them. In fact, the costs in this guide can be taken as a maximum rational sales price. For why would a player ever pay more for a UV, than he or she would pay at Punch?
(Actually, he might pay more, if he were worried about the risk of spending much more than the expected cost. More nuanced decisions like this could be made using additional information such as confidence intervals. This guide excludes confidence intervals, because they are too laborious to calculate in most cases.)
Contents
Data, Notation, and Assumptions
Items vary in the types of UVs available:
- Swords and handguns can acquire 8 types of UVs: ASI, CTR, slime, etc.
- Bombs can acquire 7 types: CTR, slime, etc.
- Helmets and suits can acquire 10 types: normal, fire, etc.
- Shields can acquire 4 types: normal, piercing, elemental, shadow.
Let T denote the number of types of UVs on your item. For example, if you're trying to UV a sword, then T = 8. We assume that all types are equally probable and that their probabilities are independent of the ticket type and each other, except that an item cannot carry multiple UVs of the same type.
Large UVs are rarer than small UVs. The exact rates are a topic of continual study. See here for an summary of several player data sets. We estimate the rates to be
- +1 (Low): 505 / 718 = 70.3%
- +2 (Medium): 162 / 718 = 22.6%
- +3 (High): 33 / 718 = 4.6%
- +4 (Very High on weapons, Maximum! on armor): 18 / 718 = 2.5%.
Let P be the probability of getting the UV or UVs that you want. For example, if you are looking for a +4, then P = 0.025. If you are looking for a +3 or +4, then P = 0.071. We assume that the size of a UV is independent of the sizes of other UVs, the type of the UV, or the type of ticket.
We let C_{1}, C_{2}, C_{3} denote the prices of the 1-, 2-, and 3-UV tickets. We do all of our calculations in terms of C_{1}, C_{2}, C_{3}, P, and T , so that we can easily recalculate if the prices change (such as in release 2011-09-06), the rates change (due to updates or just new data), or the number of types change (such as in release 2011-08-02).
Many of our calculations use the idea of combinations. For any integer N ≥ 0 and any K such that 0 ≤ K ≤ N, N-choose-K is the number of ways to choose K objects from a set of N objects. It equals N! / (K! (N - K)!). We will use mainly these cases:
- N-choose-1 = N,
- N-choose-2 = N (N - 1) / 2,
- N-choose-3 = N (N - 1) (N - 2) / 6.
Some of our analyses also use arithmetico-geometric series.
Single-UV Strategies
Suppose that you have an item with no UVs, and you want to get a single UV of your choice. Here are three strategies.
1-UV Tickets
Suppose that we buy 1-UV tickets until we obtain the desired UV. On each ticket, the probability of hitting the desired type is 1 / T, and the probability of getting the desired size is P, so the probability of getting the desired UV is P / T. The expected number of tickets is T / P, for an expected cost of C_{1} T / P.
2-UV Tickets
Suppose that we buy 2-UV tickets until we obtain the desired UV. There are T-choose-2 combinations of UV types that can be obtained. Of these, T - 1 contain the desired type. So the probability of hitting the desired type is
- (T - 1) / T-choose-2 = 2 / T.
The probability of getting the desired UV on any one ticket is 2 P / T. The expected number of tickets is T / (2 P), and the expected cost is C_{2} T / (2 P).
3-UV Tickets
Suppose that we buy 3-UV tickets until we obtain the desired UV. There are T-choose-3 = T (T - 1) (T - 2) / 6 combinations of UV types that can be obtained. Of these, (T - 1)-choose-3 don't contain the desired type, so
- T-choose-3 - (T - 1)-choose-3 = (T - 1) (T - 2) / 2
do contain the desired type. Thus the probability of getting the desired type is
- [(T - 1) (T - 2) / 2] / T-choose-3 = 3 / T,
the probability of getting the desired UV is 3 P / T, the expected number of tries is T / (3 P), and the expected cost is C_{3} T / (3 P).
Conclusion
Notice that all three costs contain a factor of T / P. Ignoring that factor, the decision comes down to which is smallest: C_{1}, C_{2} / 2, or C_{3} / 3. At current prices, the answer is C_{1}. Therefore your optimal Punch strategy is to purchase 1-UV tickets until you get that UV. The following table shows the expected costs of this strategy. For example, to get CTR+3 or better on a sword costs about 2,252,549 crowns.
Item Type | +1, +2, +3, +4 | +2, +3, +4 | +3, +4 | +4 |
Sword, Handgun | 160,000 | 539,343 | 2,252,549 | 6,382,222 |
Bomb | 140,000 | 471,925 | 1,970,980 | 5,584,444 |
Helmet, Suit | 200,000 | 674,178 | 2,815,686 | 7,977,778 |
Shield | 80,000 | 269,671 | 1,126,275 | 3,191,111 |
Second-UV Strategies
Suppose that your item already has one UV, and you want to add a second UV of your choice. Here are two strategies.
2-UV Tickets
Suppose that we buy 2-UV tickets, always locking the first UV, until we obtain the second UV. On each ticket, there are T - 1 second UV types that could be hit, so the probability of hitting the desired type is 1 / (T - 1) and the probability of hitting the desired UV is P / (T - 1). Say that we get garbage on our first K tickets, and then obtain the desired UV on the next ticket after that. The probability of this happening is (1 - P / (T - 1))^{K} P / (T - 1), and the cost is C_{2} (K + 1). The expected cost is the sum of the possible costs, weighted by their probabilities. The possibilities are indexed by K ≥ 0. So the expected cost is
- SUM_{K} (1 - P / (T - 1))^{K} P / (T - 1) C_{2} (K + 1).
This arithmetico-geometric series has value C_{2} (T - 1) / P.
3-UV Tickets
Suppose that we buy 3-UV tickets, always locking the first UV, until we obtain the second UV. On each ticket, there are (T - 1)-choose-2 possible type combinations, (T - 2)-choose-2 of which do not contain the desired type, and
- (T - 1)-choose-2 - (T - 2)-choose-2 = T - 2
of which do contain the desired type. So the probability of getting the desired type is
- (T - 2) / (T - 1)-choose-2 = 2 / (T - 1),
and the probability of getting the desired UV is 2 P / (T - 1). Say that we get garbage on our first K tickets, and then obtain the desired UV on the next ticket after that. The probability of this happening is (1 - 2 P / (T - 1))^{K} 2 P / (T - 1), and the cost is C_{3} (K + 1). So the expected cost is
- SUM_{K} (1 - 2 P / (T - 1))^{K} 2 P / (T - 1) C_{3} (K + 1),
which is an arithmetico-geometric series with value C_{3} (T - 1) / (2 P).
Conclusion
Both expected costs contain a factor of (T - 1) / P. Ignoring that factor, the decision comes down to which is smaller: C_{2} or C_{3} / 2. At current prices, C_{2} wins. So your optimal Punch strategy is to purchase 2-UV tickets, locking the first UV, until you get the second UV. Here are the expected costs.
Item Type | +1, +2, +3, +4 | +2, +3, +4 | +3, +4 | +4 |
Sword, Handgun | 525,000 | 1,769,718 | 7,391,176 | 20,941,667 |
Bomb | 450,000 | 1,516,901 | 6,335,294 | 17,950,000 |
Helmet, Suit | 675,000 | 2,275,352 | 9,502,941 | 26,925,000 |
Shield | 225,000 | 758,451 | 3,167,647 | 8,975,000 |
Double-UV Strategies
WARNING: THIS SECTION IS UNDERGOING REVISION. IT IS CURRENTLY WRONG.
Suppose that your item currently has no UVs, and you want to endow it with two UVs of your choice. For simplicity, we assume that the two UVs have the same size (for example, +2 or better on both). Here are three strategies.
2-UV Tickets without Locking
Suppose that we simply buy 2-UV tickets until the two desired UVs are obtained on a single ticket. This is obviously not the best strategy, but we discuss it first because its analysis is simple. Also, this was the main double-UV strategy until release 2012-04-25 introduced locking.
There are T-choose-2 = T (T - 1) / 2 combinations of UV types, only one of which is the combination we want. Once we get that combination, the probability of getting the desired size in both UVs is P^{2}. Hence the probability of getting the desired UVs on any one ticket is 2 P^{2} / (T (T - 1)). The expected number of tickets is T (T - 1) / (2 P^{2}), and the expected cost is C_{2} T (T - 1) / (2 P^{2}).
1-UV Tickets, then 2-UV Tickets
Suppose that we buy 1-UV tickets until we obtain one of the desired UVs. Then we buy 2-UV tickets, locking the first UV, until we obtain the second desired UV.
On each 1-UV ticket, there are three kinds of outcomes.
- You get one desired UV. The probability is P / T.
- You get the other desired UV, with probability P / T.
- You get neither desired UV, with the remaining probability 1 - 2 P / T.
On each 2-UV ticket, the probability of getting the other desired UV is P / (T - 1).
Now say that you get garbage on your first K 1-UV tickets, a desired UV on your (K + 1)th 1-UV ticket, garbage on your first L 2-UV tickets, and the other desired UV on your (L + 1)th 2-UV ticket. The probability of this happening is
- (1 - 2 P / T)^{K} (2 P / T) (1 - P / (T - 1))^{L} (P / (T - 1)),
and the cost is C_{1} (K + 1) + C_{2} (L + 1). The expected cost is a nested arithmetico-geometric series
- SUM_{K} SUM_{L} (1 - 2 P / T)^{K} (2 P / T) (1 - P / (T - 1))^{L} (P / (T - 1)) [C_{1} (K + 1) + C_{2} (L + 1)],
whose value is (2 C_{2} T + C_{1} T - 2 C_{2}) / (2 P).
Notice that the total expected cost equals C_{1} T / (2 P) + C_{2} (T - 1) / P. Comparing this cost to earlier sections, we see that it is half the cost of a single UV plus the whole cost of a second UV. That makes sense. The first UV costs half as much because we don't care which of the two UVs we get first.
2-UV Tickets
Suppose that we buy 2-UV tickets until one of the desired UVs is obtained. Then we buy 2-UV tickets, locking the first UV, until the second desired UV is obtained.
Based on the remark at the end of the preceding subsection, we can compute the expected cost as half of the cost of the first UV, plus the whole cost of the second UV. So we should get C_{2} T / (4 P) + C_{2} (T - 1) / P. But let's check that intuition.
On each of the tickets in the first stage, there are four kinds of outcomes.
- You get both desired UVs. As explained above, the probability is 2 P^{2} / (T (T - 1)).
- You get the first desired UV but not the second. There are two ways for this to happen:
- You don't get the second type at all. The probability is P, with probability
- You get the second type but not of the correct size.
- These combine into a probability
- (2 P / (T (T - 1))) ((T - 2) + (1 - P)) = 2 P (T - 1 - P) / (T (T - 1)).
- You get the second desired UV, but not the first, again with probability 2 P (T - 1 - P) / (T (T - 1)).
- You get neither desired UV, with the remaining probability 1 - 2 P (2 T - 2 - P) / (T (T - 1)).
On each of the tickets in the second stage, the probability of getting the other desired UV is P / (T - 1).
One way for the game to play out is: You could get garbage for your first K tickets, and then lucky and obtain both desired UVs on the next ticket. The probability of this happening is (1 - 2 P (2 T - 2 - P) / (T (T - 1)))^{K} 2 P^{2} / (T (T - 1)), and the cost is C_{2} (K + 1). Thus the expected cost is
- SUM_{K} (1 - 2 P (2 T - 2 - P) / (T (T - 1)))^{K} 2 P^{2} / (T (T - 1)) C_{2} (K + 1).
This is an arithmetico-geometric series. Its value, which we'll call A, is
- C_{2} T (T - 1) / (2 (2 T - 2 - P)^{2}).
The other way for the game to play out is: You get garbage for your first K tickets, the first desired UV on your (K + 1)th ticket, garbage on the next L tickets, and the other desired UV on the ticket after that. The probability of this happening is
- (1 - 2 P (2 T - 2 - P) / (T (T - 1)))^{K} 2 P (T - 1 - P) / (T (T - 1)) (1 - P / (T - 1))^{L} P / (T - 1),
and the cost is C_{2} (K + L + 2). So the expected cost is
- SUM_{K} SUM_{L} (1 - 2 P (2 T - 2 - P) / (T (T - 1)))^{K} 2 P (T - 1 - P) / (T (T - 1)) (1 - P / (T - 1))^{L} P / (T - 1) C_{2} (K + L + 2),
which is a nested arithmetico-geometric series. Its value, which we'll call B, is
- C_{2} (T - 1) (4 + 2 P^{2} + 6 P - 7 P T - 9 T + 5 T^{2}) / (2 P (2 + P - 2 T)^{2}).
Overall, the expected cost of this strategy is A + 2 B, because there are two symmetric ways for the second case to happen.
Conclusion
Your optimal Punch strategy is to purchase 1-UV tickets until you get one of your desired UVs, and then purchase 2-UV tickets, locking that first UV, until you get the other desired UV. Here are the expected costs.
Item Type | +1, +2, +3, +4 | +2, +3, +4 | +3, +4 | +4 |
Sword, Handgun | 605,000 | 1,779,410 | 4,653,850 | 10,083,300 |
Bomb | 520,000 | 1,529,410 | 4,000,000 | 8,666,667 |
Helmet, Suit | 775,000 | 2,279,410 | 5,961,540 | 12,916,700 |
Shield | 265,000 | 779,412 | 2,038,460 | 4,416,670 |
Triple-UV Strategies
WARNING: THIS SECTION IS UNDERGOING REVISION. IT IS CURRENTLY WRONG.
Suppose that your item currently has no UVs, and you want to endow it with three UVs of your choice. Here are the expected costs. [This analysis is not yet finished.]
Item Type | +1, +2, +3, +4 | +2, +3, +4 | +3, +4 | +4 |
Sword, Handgun | ||||
Bomb | ||||
Helmet, Suit | ||||
Shield |