Previously we posted an analysis from User Blue_Shift on Reddit, here is his part 2:

The Introduction – Part II

Hello again, /r/Minecraft! I’ve returned to continue what I started two days ago – an in-depth analysis of Enderdragon egg teleportation. Many of you enjoyed my first post, so I decided I should sate your desire for mathematics and pretty graphs by making another post! If you haven’t read Part 1 of my analysis, I strongly suggest that you follow this link before continuing.

From Part 1 of this analysis, we know a few important things. First of all, we know that Enderdragon eggs do not teleport according to a multivariate normal distribution. Secondly, we know exactly how the teleportation distances are calculated, thanks to the decompiled Java code (remember, the distance for each dimension is calculated separately – as the difference of two randomly generated numbers, both between 0 and 15). And finally, we know a little bit about the shape of the probability densities, thanks to our simulations.

All of those simulations from Part 1 are great, but we should really be doing some actual mathematics to figure out these probabilities. So let’s dive right in!

Deriving the Joint Probability Density Function

The probabilities themselves are easy to calculate if we’re only working in one dimension, so let’s start there. From the second-to-last image in my original post, you can see that the one-dimensional probabilities form a nice triangular shape. And since we know how to calculate probabilities for dice rolls, doing the same for Enderdragon egg teleportation shouldn’t be much harder. As a quick refresher, here’s what the one-dimensional histograms looked like:


If we call the probability of teleporting a certain number of units away on the x-axis P(X=x) and assume we’re starting from the origin (0,0), then we can define P(X=x) = (16 -|x|)/162. So, teleporting zero units along the x-axis is the most likely outcome, with a probability of 16/256 = 1/16, and teleporting 15 units along the x-axis is the least likely outcome, with a probability of 1/256. You’ll notice that the sum from -15 to +15 of this probability density function exactly equals 1. This is good! You should also note that these probabilities are the same for P(Y=y), the probability of teleporting a certain number of units away on the y-axis.

Now that we know the one-dimensional probabilities, it’s not too hard to figure out the two-dimensional probabilities (note that we’re ignoring the third dimension, height). Since P(X=x) and P(Y=y) are independent (i.e. one does not rely upon the other, since they are calculated separately), we can actually view them as marginal probabilities. So the probability of teleporting 15 units away on the x-axis is still 1/256, regardless of how far the egg teleported in the y direction. But what we want to find out is the joint probability – the likelihood that the egg will teleport to a single ordered pair, location x AND location y, or (x,y).

This is actually quite simple to calculate. An introductory statistics class will tell you that the joint probability of x and y can be calculated as follows: P(X=x, Y=y) = P(X=x | Y=y) * P(Y=y), which simplifies to P(X=x) * P(Y=y) for independent random variables. So all we have to do is multiply P(X=x) and P(Y=y) together!

Therefore, P(X=x, Y=y) = [ (16 -|x|)/162 ] * [ (16 -|y|)/162 ] = [(16 -|x|)*(16 -|y|)]/164 . If we plot a three-dimensional histogram for this joint probability density function, this is what we get:


This is very similar to the three-dimensional histogram produced from our one million simulations in Part 1. This should make us feel good, because it shows that our simulations were very accurate. But the great thing about this new histogram is that it’s mathematically exact! If we want to get a clearer look at the shape of the joint pdf, we could also plot it as a surface, but you must remember that this will be a continuous representation of the discrete world of Minecraft. Keeping that in mind, here’s a plot of the surface:


It’s quite a nice looking function! We can also look at this surface from the top to get a view of its contour plot:


Or if you prefer Wolfram Alpha’s visualizations, try visiting this link.

The Conclusion

One thing to notice is that the joint pdf isn’t actually a perfect pyramid. It starts off looking that way, but the probabilities slowly taper off as you get further from the origin. This actually makes the probability density look like a mix between a bell curve (see Wikipedia’s entry on the bivariate normal distribution) and a pyramid.

To really drive this point home, I’ve made some graphs that are “slices” of the joint probability density function. The first graph shows the joint pdf sliced horizontally (along the line y=0), and the second graph shows the joint pdf sliced diagonally (along the line y=x). These two graphs are very different from one another!


I find this immensely interesting, and I hope you all do too. Thanks for taking the time to read another one of my posts on the mathematical side of Minecraft! And please let me know if you would like to see more.

Hey Gearcrafters! Now It's your chance to share with us, just hashtag #YoGearcraft on your Twitter post with a link or image to your art, creations, videos, servers or whatever and it will appear right on our #YoGearcraft page for millions to see! It’s that easy! So what are you waiting for!? Give us a shout out #YoGearcraft!