Hey Buddy! Doing the Dampe Math
If you’ve ever watched an Ocarina of Time 100% speedrun, or played the game yourself, you’ll probably know about Dampe. As a gravedigger in Kakariko graveyard, he’ll offer to dig up graves for you when you go to him as child Link to get a random treasure. If you’re mildly lucky, you’ll get enough rupees to try again. If you’re really lucky, you’ll get the heart piece.
The latter is obviously part of the 100% definition of the game, so hundo speedruns sooner or later have to face dampe and gamble on the 10% chance of him digging up the heartpiece.
As one of the few major rng-dependent1 events in the run he’s kind of notorius, especially when he kills multiple runs in a row by needing more than 10 attempts to finally get the heart piece.
The math itself is pretty straight forward: In a speedrun, runners use a method to reset Dampe to a specific plot, allowing them to dig on the same grave spot over and over again, theoretically ad infinitum. While this method is not as “safe” as the intended method, which is capped at 15 tries maximum, it’s significantly faster unless you get “bad Dampe rng”. Each time Dampe digs, there’s a 10% chance to get the heartpiece, which means in mathy terms we can define \(p = 0.1\)
and \(k\)
as the number of tries until success, giving us:
$$P(k = 1) = p = 0.1$$
Second try Dampe would be the probability of “failing” the first attempt and then succeed afterwards, or:
$$P(k = 2) = (1-p) \times p = 0.9 \times 0.1 = 0.09$$
And in general terms:
$$P(k) = (1-p)^{k-1} \times p$$
Which, conveniently, is known as the geometric distribution. In R, we can calculate individual probabilities using dgeom(x, prob = .1)
to get the probability for “failing x
times before success”, meaning we need to use k = x - 1
to get the number of attempts it took to get the heartpiece, include the last dig.
So, with a lot of talk about odds and chances and whatnot every time Dampe is misbehaving again, I thought I’d take the opportunity to make a little lookup table to see just how unlikely your latest 61st try Dampe really was.
Here’s what’s included:
- Attempt: How often you had to let Dampe dig until the heart piece,
\(k\)
- Probability: The probability for
\(k\)
, as a singular outcome - Odds (Singular):
\(\frac{1}{\text{Probability}}\)
, the probability for that outcome in human readable terms - Probability (cumulative): Probability of
\(1\)
through\(k\)
tries, i.e. the probability for getting\(k\)
or lower tries
(So, in statsy terms, I’m basically just printing the pmf and cdf for \(k = 1\)
through \(k = 105\)
in a table. Yip.)
Attempt | Probability | Odds | Probability (cumulative) |
---|---|---|---|
1 | 0.1000000 | 1 in 10 | 0.1000000 |
2 | 0.0900000 | 1 in 12 | 0.1900000 |
3 | 0.0810000 | 1 in 13 | 0.2710000 |
4 | 0.0729000 | 1 in 14 | 0.3439000 |
5 | 0.0656100 | 1 in 16 | 0.4095100 |
6 | 0.0590490 | 1 in 17 | 0.4685590 |
7 | 0.0531441 | 1 in 19 | 0.5217031 |
8 | 0.0478297 | 1 in 21 | 0.5695328 |
9 | 0.0430467 | 1 in 24 | 0.6125795 |
10 | 0.0387420 | 1 in 26 | 0.6513216 |
11 | 0.0348678 | 1 in 29 | 0.6861894 |
12 | 0.0313811 | 1 in 32 | 0.7175705 |
13 | 0.0282430 | 1 in 36 | 0.7458134 |
14 | 0.0254187 | 1 in 40 | 0.7712321 |
15 | 0.0228768 | 1 in 44 | 0.7941089 |
16 | 0.0205891 | 1 in 49 | 0.8146980 |
17 | 0.0185302 | 1 in 54 | 0.8332282 |
18 | 0.0166772 | 1 in 60 | 0.8499054 |
19 | 0.0150095 | 1 in 67 | 0.8649148 |
20 | 0.0135085 | 1 in 75 | 0.8784233 |
21 | 0.0121577 | 1 in 83 | 0.8905810 |
22 | 0.0109419 | 1 in 92 | 0.9015229 |
23 | 0.0098477 | 1 in 102 | 0.9113706 |
24 | 0.0088629 | 1 in 113 | 0.9202336 |
25 | 0.0079766 | 1 in 126 | 0.9282102 |
26 | 0.0071790 | 1 in 140 | 0.9353892 |
27 | 0.0064611 | 1 in 155 | 0.9418503 |
28 | 0.0058150 | 1 in 172 | 0.9476652 |
29 | 0.0052335 | 1 in 192 | 0.9528987 |
30 | 0.0047101 | 1 in 213 | 0.9576088 |
31 | 0.0042391 | 1 in 236 | 0.9618480 |
32 | 0.0038152 | 1 in 263 | 0.9656632 |
33 | 0.0034337 | 1 in 292 | 0.9690968 |
34 | 0.0030903 | 1 in 324 | 0.9721872 |
35 | 0.0027813 | 1 in 360 | 0.9749684 |
36 | 0.0025032 | 1 in 400 | 0.9774716 |
37 | 0.0022528 | 1 in 444 | 0.9797244 |
38 | 0.0020276 | 1 in 494 | 0.9817520 |
39 | 0.0018248 | 1 in 549 | 0.9835768 |
40 | 0.0016423 | 1 in 609 | 0.9852191 |
41 | 0.0014781 | 1 in 677 | 0.9866972 |
42 | 0.0013303 | 1 in 752 | 0.9880275 |
43 | 0.0011973 | 1 in 836 | 0.9892247 |
44 | 0.0010775 | 1 in 929 | 0.9903023 |
45 | 0.0009698 | 1 in 1032 | 0.9912720 |
46 | 0.0008728 | 1 in 1146 | 0.9921448 |
47 | 0.0007855 | 1 in 1274 | 0.9929303 |
48 | 0.0007070 | 1 in 1415 | 0.9936373 |
49 | 0.0006363 | 1 in 1572 | 0.9942736 |
50 | 0.0005726 | 1 in 1747 | 0.9948462 |
51 | 0.0005154 | 1 in 1941 | 0.9953616 |
52 | 0.0004638 | 1 in 2156 | 0.9958254 |
53 | 0.0004175 | 1 in 2396 | 0.9962429 |
54 | 0.0003757 | 1 in 2662 | 0.9966186 |
55 | 0.0003381 | 1 in 2958 | 0.9969567 |
56 | 0.0003043 | 1 in 3286 | 0.9972611 |
57 | 0.0002739 | 1 in 3652 | 0.9975350 |
58 | 0.0002465 | 1 in 4057 | 0.9977815 |
59 | 0.0002219 | 1 in 4508 | 0.9980033 |
60 | 0.0001997 | 1 in 5009 | 0.9982030 |
61 | 0.0001797 | 1 in 5565 | 0.9983827 |
62 | 0.0001617 | 1 in 6184 | 0.9985444 |
63 | 0.0001456 | 1 in 6871 | 0.9986900 |
64 | 0.0001310 | 1 in 7634 | 0.9988210 |
65 | 0.0001179 | 1 in 8482 | 0.9989389 |
66 | 0.0001061 | 1 in 9425 | 0.9990450 |
67 | 0.0000955 | 1 in 10472 | 0.9991405 |
68 | 0.0000860 | 1 in 11635 | 0.9992264 |
69 | 0.0000774 | 1 in 12928 | 0.9993038 |
70 | 0.0000696 | 1 in 14364 | 0.9993734 |
71 | 0.0000627 | 1 in 15960 | 0.9994361 |
72 | 0.0000564 | 1 in 17733 | 0.9994925 |
73 | 0.0000508 | 1 in 19704 | 0.9995432 |
74 | 0.0000457 | 1 in 21893 | 0.9995889 |
75 | 0.0000411 | 1 in 24326 | 0.9996300 |
76 | 0.0000370 | 1 in 27028 | 0.9996670 |
77 | 0.0000333 | 1 in 30031 | 0.9997003 |
78 | 0.0000300 | 1 in 33368 | 0.9997303 |
79 | 0.0000270 | 1 in 37076 | 0.9997573 |
80 | 0.0000243 | 1 in 41195 | 0.9997815 |
81 | 0.0000218 | 1 in 45772 | 0.9998034 |
82 | 0.0000197 | 1 in 50858 | 0.9998230 |
83 | 0.0000177 | 1 in 56509 | 0.9998407 |
84 | 0.0000159 | 1 in 62788 | 0.9998567 |
85 | 0.0000143 | 1 in 69764 | 0.9998710 |
86 | 0.0000129 | 1 in 77516 | 0.9998839 |
87 | 0.0000116 | 1 in 86128 | 0.9998955 |
88 | 0.0000104 | 1 in 95698 | 0.9999060 |
89 | 0.0000094 | 1 in 106331 | 0.9999154 |
90 | 0.0000085 | 1 in 118146 | 0.9999238 |
91 | 0.0000076 | 1 in 131273 | 0.9999314 |
92 | 0.0000069 | 1 in 145859 | 0.9999383 |
93 | 0.0000062 | 1 in 162065 | 0.9999445 |
94 | 0.0000056 | 1 in 180073 | 0.9999500 |
95 | 0.0000050 | 1 in 200081 | 0.9999550 |
96 | 0.0000045 | 1 in 222312 | 0.9999595 |
97 | 0.0000040 | 1 in 247013 | 0.9999636 |
98 | 0.0000036 | 1 in 274459 | 0.9999672 |
99 | 0.0000033 | 1 in 304954 | 0.9999705 |
100 | 0.0000030 | 1 in 338838 | 0.9999734 |
101 | 0.0000027 | 1 in 376487 | 0.9999761 |
102 | 0.0000024 | 1 in 418318 | 0.9999785 |
103 | 0.0000022 | 1 in 464798 | 0.9999806 |
104 | 0.0000019 | 1 in 516442 | 0.9999826 |
105 | 0.0000017 | 1 in 573825 | 0.9999843 |
-
Random number generator; in speedrunning terms it’s become synonymous with ‘random event’ or ‘specific outcome of an event determined by [pseudo] random number generation’. I know it’s kind of weird to use “rng” as an adjective or catch-all term, but oh well. Context and such. ↩︎