Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

HARVEST DIVINATION CARD DOUBLING

NERDYJOE

Abstract. Using the Harvest craft to gamble on divination cards, the odds of getting a
complete stack of that divination card is the same as the fraction of cards you currently
have. However, there are betting strategies which will give a higher chance to end up with
zero cards. Nevertheless, the expected number of cards is never changed by the harvest
craft, so all betting strategies are equally good or bad, so long as each additional card is
valued the same as the first. We discuss exact probabilities and exact mathematics that
goes into this outcome, as well as compute several example starting amounts.

1. Introduction

In Path of Exile, there is a sub-mechanic of Harvest which involves gambling divination


cards. Killing a Primal Rhex will sometimes give you the option to gamble with divination
cards. The input of this operation is some number of divination cards less than half a total
stack. The output is some number of divination cards between 0 and twice the number
that was put in. We will assume no cost to use this Primal Rhex craft. This problem is
very similar to the historical concept in mathematics of the gambler’s ruin problem. In this
document, we investigate strategies to use the craft to its maximum potential.

2. Background on Markov Chains

The key tool in this document is a Markov chain. We represent these chains in matrix
form. Each row and column represents some state, for us, the number of cards in your stash.
Multiplying by a transition matrix T describes all the possible outcomes of doing a Harvest
craft, and the probability of each. For simplicity, we only consider models where the number
of cards in the stash determines how many cards are bet with.

Repeated multiplication by a transition matrix T describes the result of multiple crafts


in sequence. In the long term, this stabilizes to some point. This result is called the steady
state. Mathematically, it can be described as the matrix S so that the sum of all the entries
in a row is 1, and so that the matrix multiplication T S = S. This matrix S encapsulates
everything that can happen long-term in the system modeled.

The various sections of this document describe a few ways to gamble, and show the tran-
sition matrix and steady-state matrix for each.
1
2 NERDYJOE

3. The simple way to gamble

The first method of using this mechanic we consider is to only put in one card at a time.
If we start with k cards, and craft a single card, the outcome will be k − 1 with probability
1
3
, k with probability 13 , and k + 1 with probability 13 .

This gives one row of the transition matrix. There are two exceptional rows. One, when
you have 0 cards, where the “outcome” is always 0 cards. The other, is when you have all n
cards desired, then you stop gambling. All together, we write the transition matrix below:

1 0 0 0 0 0 ...
 
 13 31 13 0 0 0...
 1 1 1
0 3 3 3 0 0...

T =
 ... ... ... ... .. .. 
..
 . . .
0 0 0 0 . . . 3 13 
1

0 0 0 0 ... 0 1

For the above transition matrix, we compute the steady state matrix

1 0 0 0 ... 0 0
 
 n−1
n
0 0 0 ... 0 1
n

 n−2 2
0 0 0 ... 0

 n n

S=
 ... .. .. .. .. .. .. 
 . . . . . . 

 1 0 0 0 ... 0 n−1 
n n
0 0 0 0 ... 0 1

Then simple matrix multiplication verifies that T S = S.

We now interpret this matrix. The kth row indicates the probability distribution of the
number of cards you’ll have after a (possibly infinite) number of gambles. In particular,
starting with k out of n cards, there’s a n−k
n
chance to have 0 cards, and a nk chance to have
n out of n cards.

Using this method gives our baseline result, but this process is slow, and takes lots of
crafts.

TODO: figure out how many crafts it takes.

4. All in

We can instead bet in an ”all in” method. In this circumstance, we bet all the cards we
can. We are limited by the number of cards we have, and the “half of maximum” constraint.
(Since I don’t have the craft in-game, I don’t know how the rounding works.) We assume
HARVEST DIVINATION CARD DOUBLING 3

that for cards with odd number of maximum cards round down. So a card with a stack size
of 9 has a maximum bet stack of 4.

The transition matrix for a card with (odd) stack size n will now look like this:

1 0 0 0 0 ... 0 0
 
 31 13 13 0 0 . . . 0 0 
1 1 1 1 1
5 5 5 5 5 . . . 0 0


T =
 ... ... ... ... ... . . . .. .. 
 . . 

0 0 0 0 0 . . . 1 n 
n+1 2n+2
0 0 0 0 0 ... 0 1

A generic row in the middle will be of one of two forms. Using 0-indexing, the kth row
1 1 1
will be ( 2k+1 , 2k+1 , . . . , 2k+1 , 0, 0, . . . , 0) if it is in the first half of the matrix. For odd n, it
1 1
will be (0, 0, . . . , 0, n−1 , . . . , n−1 , k−((n−1)/2)
n−1
) if it is in the second half of the matrix. For even
n, in the second half of the matrix, the kth row will be (0, 0, . . . , 0, n+1 1 1
, . . . , n+1 , k−(n/2)+1
n+1
)

As a concrete example, we list three of these transition matrices, where n = 3, 4, 5.

 
1 0 0 0
 1 1 1 0
T3 =  3 3 3 
0 1 1 1 
3 3 3
0 0 0 1
 
1 0 0 0 0
 1 1 1 0 0
 31 31 31 1 1 
T4 =  
 5 51 51 51 52 
0 
5 5 5 5
0 0 0 0 1
 
1 0 0 0 0 0
 1 1 1 0 0 0
 31 31 31 1 1 

5 5 5 5 5
0
T5 = 
0 1 1 1 1 1 

 5 51 51 51 52 
0 0 
5 5 5 5
0 0 0 0 0 1

Continuing the concrete examples, we have steady state matrices of

 
1 0 0 0
2 0 0 31 
S3 =  3 
1 0 0 32 
3
0 0 0 1
4 NERDYJOE

 
1 0 0 0 0
19/25 0 0 0 6/25 
 
13/25
S4 =  0 0 0 12/25

 8/25 0 0 0 17/25
0 0 0 0 1

1 0 0 0 0 0
 
65/80 0 0 0 0 15/80
50/80 0 0 0 0 30/80
 
S5 = 
34/80 0 0 0 0 46/80

21/80 0 0 0 0 59/80
0 0 0 0 0 1

Comparing the left hand columns to those from the one-at-a-time method, we see they are
slightly worse. However, this doesn’t account for the possibility of bonus cards. Generalizing
these concrete results to any stack size is hard, but several different values of interest appear
at the end of this document. We deal with the extra card issue in Appendex 1. However,
we can bet a different way, our next method, to avoid the possibility of extra cards, but also
finish faster than the one-at-a-time method.

TODO: figure out how many crafts it takes.

5. Bet to be lucky

This strategy is a bit like the one before, however we always bet the right amount to be
done if we get the best possible luck. It makes the matrix symmetric under a half rotation.
The general matrix looks like this:

 
1 0 0 0 0 ...
0 0 0 0 0
 31 13 13 0 0 ...
0 0 0 0 0
1 1 1 1 1
...
0 0 0 0 0

5 5 5 5 5
. . . . .. . .
.. .. .. .. .. 
 .. .. .. ..
T = . .
. . . . . 
0 0 0 0
 0 . . . 51 51 15 51 51 
0 0 0 0 0 . . . 0 0 13 31 31 
0 0 0 0 0 ... 0 0 0 0 1

In this case, it is possible to compute the general result, and it works out to be the same
as the one-at-a-time method.
HARVEST DIVINATION CARD DOUBLING 5

1 0 0 0 ... 0 0
 
 n−1
n
0 0 0 ... 0 1
n

 n−2 2
0 0 0 ... 0

 n n

S=
 ... .. .. .. .. .. .. 
 . . . . . . 

 1 0 0 0 ... 0 n−1 
n n
0 0 0 0 ... 0 1

To illustrate how to check this, we consider the kth row of T with the first column of S.

2k
X 1 n−i
(T S)k,1 =
i=0
2k + 1 n
2k
1 X
= n−i
(2k + 1)(n) i=0
1
= ((2k + 1)n − (2k)(2k + 1)/2)
(2k + 1)(n)
1
= (n − (2k)/2)
n
n−k
=
n

The outcome is the same as the one-at-a-time method, but you get to the eventual result
faster, since more is gained or lost at a time.

TODO: figure out how many crafts it takes.

6. Conclusion

In general, if you have k out of n divination cards, and you use the Primal Rhex craft
on these cards, you have a k out of n chance of getting to a full stack before running out
of cards. The method of getting to the full stack does not matter, unless you bet in a way
where you may end up with extra cards at the end. These over-betting strategies may get
you to a steady-state sooner, with a slightly higher chance to fail. This higher chance to fail
is mathematically balanced by the possibility of returning more cards than a full stack.

If there are other methods that deviate significantly from those described here, you’re
welcome to reach out to me however you can. I may update this in the future.

Since every operation has 0 net change in the expected number of cards after the operation,
no matter the method, as long as a method ends in only 0 cards or a full stack, the result is
the same. There is a k out of n chance to end up with a full stack.
6 NERDYJOE

Appendex 1: Accounting for extra cards

Here we consider the same all-in strategy, but add columns for the over-stack cards. We do
this by having each column represent a number of cards in the inventory, without restriction
on size. We preserve the stop-when-full idea, but this allows us to track more than just done
or not.

An example transition matrix and stable state matrix for n = 4, 5 divination cards.

 
1 0 0 0 0
1 1 1 0 0 0
 31 31 31 1 1


5 5 5 5 5
0 
T4 = 
0 1 1 1 1 1

 5 5 5 5 5
0 0 0 0 1 0
0 0 0 0 0 1

1 0 0 0 0 0
 
19/25 0 0 0 5/25 1/25
13/25 0 0 0 10/25 2/25
 
S4 = 
 8/25 0 0 0 10/25 7/25

 0 0 0 0 1 0 
0 0 0 0 0 1

1 0 0 0 0 0 0
 
 31 13 31 0 0 0 0
1 1 1 1 1
0 0

5 5 5 5 5
T5 =  0 15 51 15 1 1
0
 
5 5
 0 0 15 15 1 1 1

5 5 5
0 0 0 0 0 1 0
0 0 0 0 0 0 1

1 0 0 0 0 0 0
 
65/80 0 0 0 0 10/80 5/80 
50/80 0 0 0 0 20/80 10/80
 
S5 = 34/80 0 0 0 0 36/80 10/80
 
21/80 0 0 0 0 34/80 25/80
 
 0 0 0 0 0 1 0 
0 0 0 0 0 0 1

The expected value for each of the starting amounts of cards is now the same as the other
methods, as long as the extra card(s) have value.
HARVEST DIVINATION CARD DOUBLING 7

Appendex 2:Specific chances for the all in strategy

Here I pick some particular stack sizes of divination cards, and compute the probability
of failure of the all-in strategy with specific numbers of starting cards. As the previous
Appendex noted, the expected value of this strategy is the same as the other strategies, but
it has a higher failure chance. The entries in the table are the numerators for specific stack
sizes and starting numbers of cards.

The stack sizes are: 8 (Patient, Nurse, Doctor), 9 (House of Mirrors), 10 (The Immortal
and The Demon), 11 (The Fiend), 13 (Seven Years Bad Luck).

Stack size Denominator Number of starting cards


1 2 3 4 5 6
8 4014 3555 3096 2647 2168 1722 1327

9 41994 37755 33516 29187 25128 20462 16267

10 68354 62194 56034 49786 43802 37273 31059

11 1387111 1272678 1158245 1044032 929159 821550 695449

13 329457544 306637851 283818158 261187485 237989752 215287267 193934338


Number of starting cards
7 8 9 10 11 12
8 4014 983

9 41994 12543 9300

10 68354 25405 20311 15785

11 1387111 579751 474456 379544 295075

13 329457544 168591450 145003923 123171757 103080412 84773508 68212949

As an example, if we start with 7 “Seven Years Bad Luck”, the chance we end up with 0
“Seven Years Bad Luck” before getting a full stack (and possibly more), while going all-in
on every Harvest craft, is 168591450/329457544, or approximately 51.17%. Taking either of
the more cautious approaches, the chance is 6/13, or about 46.15%, a noticeably lower risk.

You might also like