User Blue_Shift on Reddit has done an in depth analysis of Enderdragon egg teleportation. Part II coming soon.


The Introduction


01-Egg_teleporting_distanceI saw this image posted in another thread on /r/Minecraft, and it got me interested in analyzing Enderdragon egg teleportation. I decided to conduct my own experiment on Enderdragon egg teleportation, and here’s what I came up with after 780 trials.


The Experiment


02-5T89LtRhttp://i.imgur.com/5T89LtR.jpg

This screenshot shows a 31×31 grid of teleportation locations, color coded according to how often the Enderdragon egg landed on that square. In order of increasing frequency, the colors are White(0), Grey(1), Yellow(2), Orange(3), Red(4), Purple(5), and Black(6). As you can see, the higher density regions are closer to the origin (in the center, marked by a fence post), and the density falls off as you get further from the origin. If you prefer looking at output from R’s ggplot function, then this image is equivalent to the one above (except it’s rotated 90 degrees):

03-6NBQOw7http://i.imgur.com/6NBQOw7.png

At first glance, the distribution appears to be bivariate normal. However, if we conduct some normality tests, we can see that this is actually not true! We can also see this visually by comparing the above graph to a graph of 780 normally distributed points:

04-KLXt6nBhttp://i.imgur.com/KLXt6nB.png

These graphs are very different from one another, so it’s not surprising that the normality test failed! We can now conclude with certainty that Enderdragon eggs do not teleport according to random samples from a normal distribution. It’s difficult to tell what the real distribution is just by looking at the original 780 trials, since our sample size is relatively small. But thanks to /u/furitiem‘s post, we know exactly how the teleportation distances are calculated.


The Simulations


The following Java code can help us figure out the true distribution.

new_x = old_x + rand.nextInt(16) – rand.nextInt(16);

new_y = old_y + rand.nextInt(8) – rand.nextInt(8);

new_z = old_z + rand.nextInt(16) – rand.nextInt(16);

If you know a little bit of statistics, it’s easy to figure out what the distribution of a sum (or difference) of two uniform distributions is. But before we do that, let’s translate the above Java code into R and run some simulations to make sure our 780 in-game trials actually match up with whatshould happen.

x <- rep(NA, 780)

for(i in 1:780){

new_x <- sample(0:15, 1) – sample(0:15, 1)

x[i] <- new_x

}

y <- rep(NA, 780)

for(i in 1:780){

new_y <- sample(0:15, 1) – sample(0:15, 1)

y[i] <- new_y

}

df <- data.frame(x, y)

p <- ggplot(df, aes(x, y))

p <- p + stat_bin2d(bins = 31)

p

This code outputs the following plot:

05-ah3IXe7http://i.imgur.com/ah3IXe7.png

If you compare this graph to the first ggplot graph I showed, it’s easy to see that they’re very similar. Due to the nature of the simulations, they will never be exactly the same – but they’re close enough that we can be sure our 780 trials were performed correctly.

Now, what should the probability density function itself look like (using one million trials)? Well, this would be a pretty close approximation:

06-ovmNvjZhttp://i.imgur.com/ovmNvjZ.png

07-bZFahpzOr if we view it in three dimensions:

http://i.imgur.com/bZFahpz.png

So if you spawned one million Enderdragon eggs and hit them so that they all teleported away, this is was the resulting pile of eggs would look like. And what do you know – It’s not a bell, but a pyramid! And if we look at each dimension separately, these histograms show us the true nature of Enderdragon egg teleportation:

08-LEV1fm8http://i.imgur.com/LEV1fm8.png

These histograms have a similar form to the histogram that is generated by repeatedly rolling 2 dice and recording their sum:

09-EIYAJPRhttp://i.imgur.com/EIYAJPR.png

If you understand why dice rolls work this way, then you should understand why Enderdragon eggs do as well. Since each roll of a die is uniformly distributed, the sum of two dice rolls forms a nice triangular/pyramidal histogram.


The Conclusion


In conclusion, Enderdragon eggs are most likely to spawn very close to their original location, and – here’s the kicker – the probability of them teleporting x distance away from their origin (in any one dimension) decreases linearly as the teleport distance increases.

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!