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

The Introduction – Part III


Hello again, /r/Minecraft! I hope you’re ready for round three of An analysis of Enderdragon egg teleportation. If you haven’t read the first two threads yet, you can find them here:

Part 1

Part 2.

But if you don’t feel like reading my other two posts, that’s okay. This post is less mathematically oriented than the other two, so feel free to jump right in!


The Inspiration


This post was inspired by the The Magic 8 Cube, an implementation of a gambling game that utilizes Enderdragon egg teleportation. This idea, originally posted by /u/Pwntiff, was quite clever, but it was lacking something – the probabilities weren’t uniform. That is, the chance of landing on a certain 3×3 square varied as you got further from the origin. The squares closer to the middle of the room were far more likely to be hit than the squares at the edge of the room.

I created my own Magic 8 Cube to investigate this phenomenon. Here are the probabilities of the Enderdragon egg landing on each square:

These probabilities sum to 51.66%, because there is a 48.34% chance the egg will attempt to teleport outside of the enclosure. Since the Magic 8 Cube is solid on the outside, this can never happen. To my understanding, whenever the egg tries to teleport to a square that is already occupied, it simply tries again until it finds a vacant square. Therefore, the correct probabilities for the Magic 8 Cube can be found by scaling the percentages in my image by approximately 2. But that’s not important! The important thing to notice is that the probabilities are not uniform. It doesn’t matter if the top left square has a 1.37% chance of getting picked or a 2.74% chance. The only thing that matters is that the squares do not all have the same chance of getting picked! Therefore, the Magic 8 Square is not a fair game.

So, is it possible to create a fair game? That’s the question this post is concerned with, and we’re going to answer it in excruciating detail!


The Creation of a Fair Game


Instead of starting with a 15×15 room surrounded by thick walls of stone, we’re going to start with a 31×31 platform out in the ocean. I added a perimeter of black-and-white wool around the platform to help me count, but this isn’t required.

This design, unlike the Magic 8 Cube, does not restrict the Enderdragon egg’s movement in any way. Enderdragon eggs can’t teleport more than 15 squares in any one direction, so a 31×31 platform is the perfect size for our game board. And since we built the platform over water, it’s impossible for the egg to teleport under the platform itself. If we built our platform in the air, the Enderdragon egg would teleport under the platform a little less than 50% of the time. But we don’t have to worry about this, because Enderdragon eggs have a serious fear of water!

Now we need to divide the game board up into sections, which I call “regions of equal probability”. We know that 3×3 squares won’t work, but is there any shape or pattern that will? It’s tough to say. In order to answer this question, we have to first look at the joint probability density function that we derived in the last thread.

Using this image (or rather, the raw data that generated it), we need to find groups of “pillars” that have the same height when they’re stacked on top of one another. In mathematical terms, we need to make it so that the sum of the probabilities are the same across all regions. This might sound like an easy task, but the joint pdf shown above isn’t very friendly. And it’s especially hard to accomplish if we try to include every square from the 31×31 grid in the analysis. If you want to try this for yourself, you can download the probability dataset here. I’ll give you a hint: It makes things a lot easier if you scale the values in that dataset by 216. Here’s a download to the scaled probability dataset, where you’re working with whole numbers instead of decimals.

Now, let’s divide up the game board. The first thing we need to decide is how many regions we want. I’m going to divide my game board up into 8 regions of equal probability, but you can choose a different number of regions for your own game board. 8 is by no means a special number – it’s just easier to work with.

If you’ve been following along, you may have noticed that the joint pdf has some symmetry – along the x-axis and along the y-axis (and, incidentally, along both diagonals). We’re going to take advantage of this symmetry by dividing our game board up into 4 regions and then dividing each of those regions into 2 smaller sub-regions. In the end, all 8 regions will have equal probabilities. Here’s a screenshot of an Excel file showing the end result:

The 8 regions of equal probability are grouped by color, and they each have the same sum. You can check for yourself if you don’t believe me! There is exactly a 12.5% chance that each region will be visited by the Enderdragon egg. Unlike the Magic 8 Cube, there is no variability here – the probabilities are uniform.



The Building Process


So let’s start constructing this in Minecraft! Here is our 31×31 game board:

And now we add the first region:

And the second region…

And so on and so forth, until we have this:

Voila! There we have it – our game board is divided up into 8 regions of equal probability, and we’re ready to play. All you have to do is place an Enderdragon egg on the black square in the middle and let it decide your fate!

Note: It is possible for the Enderdragon egg to teleport to the black square. In fact, there is a 1-in-256 chance of this happening. So if that happens, you should simply try again. Or maybe teleporting back to the origin wins you a special prize.. It’s entirely up to you!


Extra Material


As a bonus, here’s another possible game board:

This one is divided up into 5 regions, and it’s easier to implement. However, be warned! The probabilities are not uniform here. They’re close, but they’re not exact. For a 5-region game board, you want each region to have a 20% probability, but here are the probabilities for the regions in the picture above:

Magenta: 20.08%

Blue: 20.08%

Green: 20.08%

Orange: 20.08%

Cyan: 19.68%

If these probabilities are close enough for you, then I encourage you to use this game board. However, if you need your regions to all have exactly the same probabilities, then you should either use the 8-region game board I created or create your own.

Thanks for reading!


Downloads


If you want to poke around my world in Creative mode, here’s a link to the savefile:

https://www.dropbox.com/s/k850cdczkpxxsd3/Dragon%27s%20Egg.zip

And if you want to run the R code from Parts I and II (and a little from Part III) for yourself, you can do so with this script:

https://www.dropbox.com/s/0fyqdyzw2ix6r7x/dragon_egg.R

 

If you Enjoyed this please Like comment and SHARE ON FACEBOOK! :)

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!