# How many possible outcomes will there be to my Minecraft lock? [closed]

I just built a lock for a door in Minecraft. The user has to pick the correct four colors out of twelve. Order doesn't matter. What is the probability of the user guessing the correct colors?

• One, me putting a redstone torch in front of said locked door and walking through. Commented Jun 24, 2011 at 2:13
• @Nick Every experienced lock-maker knows to set it up so the door is closed when powered. :P Commented Jun 24, 2011 at 6:26
• I don't see how this is on topic. It is a pure math question that has nothing really to do with gaming. Commented Jun 25, 2019 at 13:41
• @Soup Please remember that Be Nice applies to all users, no matter how old the question is. Assuming good faith when interacting with other users is expected. Commented Jul 8, 2019 at 2:38
• I’m voting to close this question because it's about mathematics, not gaming. Commented Jul 11, 2022 at 1:06

1. You have 4/12 of a chance of picking the first colour right.

2. You have 3/11 of a chance of picking the second colour right from the remaining eleven colours, if you got the first right.

3. You have 2/10 of a chance of picking the third colour right from the remaining ten colours, if you got the former two colours right.

4. You have 1/9 of a chance of picking the fourth colour right from the remaining nine colours, if you got the former three colours right.

Hence, the probability of guessing the combination is: 4/12 × 3/11 × 2/10 × 1/9 = 495-1.

In other words, there are 495 different combinations, of which one is correct.

Obviously, all of this is useless, unless you are working on a exploration mode map. It's much faster to just take a pick and destroy your door.

• You could some how set it up so if any wall is destroyed TNT or lava is released, lava would be better because if you returned it wouldn't have destroyed the wall like TNT would. Commented Jan 30, 2011 at 11:44
• You don't need to release lava, having it stream down in the first place behind each wall works just as well. If the lava flows from far enough above and goes deep then the player can't easily block it off to pass through. Commented Jan 30, 2011 at 16:52
• @Sadly, if the player opens the door with the code, how is he not also killed by the lava? (I have not played Minecraft, just curious)
– juan
Commented Jun 24, 2011 at 15:29
• @JuanManuel, I dunno, use some pistons or that business :P it's much easier to block off one column of lava than wait for however many more to be released. Commented Feb 24, 2012 at 17:28

Use the Choose function. You have 12 items, from which you can choose 4 and the order of those chosen 4 does not matter. This means you want to calculate 12 choose 4.

n choose k = n! / (k! * (n - k)!)

So, you have 12!/(4!8!) = 495 different choices, giving you a probability of choosing the one correct answer 1/495 = .00202... = 0.2%

Maths.

• love the simplicity of this answer...
– Soup
Commented Jan 29, 2011 at 20:55
• it isn't the 'choose' function, it's actually the binomial expansion :) Commented Jun 24, 2011 at 9:12
• @The Communist Duck: Same thing! en.wikipedia.org/wiki/Binomial_coefficient "often read as 'n choose k'" Commented Jun 24, 2011 at 9:52
• My bad :P I learnt it as binomial. Commented Jun 24, 2011 at 10:16