Kim Williams
United Kingdom St Just Cornwall

Last night my husband and I were playing the Enigma Code scheme, and reached a point where we we ended up making a guess for the fourth colour in the code. It was my husband's turn and his guess (based on his understanding of the probabilities of the situation) so jarred with with mine that we ended up debating the probabilities (with many scrawlings on our white board) for a big chunk of the evening.
The maths was too much for us but wondered if anyone could help us to get beyond just our intuitions.
So in the scheme, in order to fight the villain you need the colours (and order of the colours) that make the code. The colours are the colours of hero card placed initially face down, but which you can pay a recruit when you fight a villain to look at a specific card. Every time there's a scheme twist you add a new face down card and mix it with the rest, meaning the code gets longer with every twist.
At a point in the game we'd identified all three colours and their order: yellow, green, green.
We were all set to fight the mastermind, but then we got a scheme twist. meaning we now had a fourth card of unknown colour, and the order of all four cards were now unknown.
Over the next couple of turns we looked at three of the four cards. We now knew the order now went green, green, yellow, X.
My husband decided to fight the villain making a guess at the fourth card. He guessed red. I felt that was a really odd choice (thinking that there would be a higher chance of it being green or yellow). It was yellow. Probability discussions ensued for the next hour, until we finally returned to finish our game.
In my mind, as there was (in abstract) a 3 in 4 chance that the fourth card in the row was one of the three cards we'd previously seen, there was a higher chance of it being green or yellow than any of the other three colours, so why on earth would you guess red? My husbands thinking was that as we'd turned over three cards that matched our three previous card we had effectively no knowledge about the fourth card, in which case there was just as much chance of it being red as any other colour.
He did crunch the probabilities for a much simpler scenario  two cards with only two colour options. He was satisfied that if you'd previously identified one colour, before adding a second and then shuffling both, and then looking at one card and found it was the same colour as previously identified, the second was more likely to be the same than different. But crunching the probability for a four card spread, with 5 possible colours, and with three previously identified, was just too much.
We did realize afterwards that if we'd just paid attention to the specifics of the hero cards (rather than just their colours) we probably identified whether a card was a new green card or just likely to be the same green turning up again. However I think it's interesting as just an abstract puzzle imagining that the cards are all just one of five colours, and equally imagining that they come from an infinite deck, made up of equal numbers of each colour.
So if anyone is a dab hand at working out probabilities, the probability question is:
Given that when we had only three cards we knew we had two greens and a yellow, then when we added a fourth card and remixed, we found out that the first three cards went, in order green, green, yellow, what was the probability of the fourth card being a)green b) yellow or c)any one of the three other possible colours.
Thanks in advance if anyone can help us out. I hope I've explained things well enough  but if not please feel free to ask for clarification.
Ooh and I'll give a hefty geek gold tip if anyone can work it out.

Jason Walker
United States Madison Heights Virginia
See the Legendary forums for monthly solo leagues!

It's all going to depend on the heroes involved. Let's say you've got the 4 heroes above in the hero deck. There are 15 red cards, 9 yellow, 9 blue, 10 green, and 13 black for a total of 56 cards. You can subtract out what you've seen in the code, what's in your hands and discard piles, as well as what's in the HQ and KO pile. That should give you a better number to work from when making your guess.

Kim Williams
United Kingdom St Just Cornwall

TravelSized wrote: It's all going to depend on the heroes involved. Let's say you've got the 4 heroes above in the hero deck. There are 15 red cards, 9 yellow, 9 blue, 10 green, and 13 black for a total of 56 cards. You can subtract out what you've seen in the code, what's in your hands and discard piles, as well as what's in the HQ and KO pile. That should give you a better number to work from when making your guess.
We were more intrigued by it as an abstract puzzle  imagine that there is an infinite deck, made up equally of the five colours, so that there is an equal chance of being any given colour combination (so that, for example, green, green, green, green, is just as likely as any other given combination).
This intrigues us because it's here where our intuitions differed. My intuition felt that as there was a greater chance that the fourth card in the row was one we'd previously seen when we looked at the the entire three card code, one ought to guess green or yellow, where as my husband's intuition led him in a different direction. Neither of us was trying to take into account the exact colour make up of a deck made up of around 100 cards.

Stephen Eckman
United States Oviedo Florida

I don't know the game and am a novice at probability ... so I could be way off here. But here is my thinking (and for simplicity sake, let's assume you have a 1/5 chance of drawing each color from the deck).
You known the colors of 3 cards (yellow, green, green) and one unknown card.
When inspecting again:
The odds that the 4th card is actually one of your previously seen green cards is 50%. The odds that it is a new green card is 5% (1/4 * 1/5). So odds that it is a green card? 55%
The odds that the 4th card is actually one of your previously seen yellow cards is 25%. The odds that it is a new yellow card is 5%. So odds that it is a yellow card? 30%
The odds that the 4th unknown card is new and one of the other 3 colors: 15% (1/4 * 3/5).
That doesn't factor any knowledge gained from looking at the first 3 cards when inspecting again ... but in your case I'm not sure any knowledge was gained (at least in the simple model where the card draw probabilities are even).

Jeremy Lennert
United States California

I believe we can calculate this probability using Bayes' Theorem.
P(AB) = P(BA) * P(A) / P(B)
You want to know the probability that the fourth card is red, given that you revealed green, green, and yellow. So let
A = the event that the new card is red B = the event that the first three cards you reveal are green, green, and yellow
Then
P(A) = 20% Initially, we assume all 5 colors are equally likely
P(BA) = 25% Given that the new card was red, the odds that you would NOT see a red card after revealing 3 out of 4 is 25% (the red card had a 1/4 chance of being the last card)
P(B) seems more difficult to calculate. I think the best option here is to sum P(BA)*P(A) for all possible colors Red, blue, or black: P(BA) = 25%, as described above Yellow: P(BA) = 50% (there's a 2/4 chance that one of the two yellow cards would be last) Green: P(BA) = 75% (there's a 3/4 chance that one of the three green cards would be last) That means P(B) = 60%*25% + 20%*50% + 20%*75% = 40% P(B) = 40%
So now we can apply Bayes' Theorem to calculate P(AB), the probability that the new card is red given that you revealed green, green, and yellow.
P(AB) = P(BA) * P(A) / P(B) = 25% * 20% / 40% = 12.5%
The probability of the fourth card being red has dropped from 20% to 12.5% because of your knowledge of the first three cards.
On the other hand, if we consider the probability of the last card being green... P(A) = 20% P(BA) = 75% P(B) = 40% P(AB) = 75% * 20% / 40% = 37.5%
Green is definitely a better guess (assuming that all 5 colors were equally probable initially).
(As a sanity check, if you repeat that math for all 5 colors, you'll find that the probabilities do, in fact, add up to 1.)

pacemaker 67
United States Naperville Illinois

I'll post a solution later, but I agree
P(G)=3/8 P(Y)=2/8 P(R) = 1/8 P(Blue) = 1/8 P(Black)=1/8 where P(C) = probability that the last card is color Cxxx.

Gary Duke
United Kingdom Fleet Hampshire

Another way to calculate the probabilities is to try to find the set of equally probable events underlying this, and then eliminate those that are impossible.
First, when you drew the fourth card, all colours were equally likely. Then, you looked at three cards, and there are four equally probable cases for which three you saw. For convenience, let's label these by which card you didn't see. We therefore get 20 equally probable events: Red and card 1 is still hidden, Red and card 2, ... Green and card 1, ... .
Now we can label the two known green cards as 1 and 2, and the known yellow card as card 3, leaving the unknown card as card 4. Then we can eliminate any of our 20 possibilities that don't fit with the colours you saw. So, any of red, blue, or black, and any of cards 1, 2, or 3 being still hidden are impossible. We can also eliminate Green/3, Yellow/1, and Yellow/2. This leaves 8 possibilities: Red/4, Blue/4, Black/4, Green/1, Green/2, Green/4, Yellow/3, and Yellow/4. Of these, 3 are green, 2 are yellow, and 1 are each of the other three colours. So, green is 3/8 = 37.5%, yellow is 2/8 = 25%, and each of red, blue, and black is 1/8 = 12.5%.
In practice, you would have to weight the original colour probabilities based on how many cards of each colour haven't been seen yet, but there would have to be quite a lot more red cards than yellow or especially green to make it a better guess.

David "Davy" Ashleydale
United States Oakland California

I guess the best way to think about it is that your initial 3 cards had 2 greens in them, so when you add in a 4th card, but you still see 2 greens come up in the first 3 cards, the most likely reason is that you have even more greens now.

David "Davy" Ashleydale
United States Oakland California

But kudos to you, Kim, for intuiting this non intuitive (to me) probability problem. I initially completely agreed with your husband.

Kim Williams
United Kingdom St Just Cornwall

Thanks everyone for the responses  I'm going to have to read them through a bit more carefully.
My son wrote a programme that worked out the ratios were 3:2:1 of it being green:yellow: any other colour (thus 3 time more likely to be green than a colour other than green or yellow, and twice as likely to be yellow than a non green/yellow colour)  so now I want to see how that compares to the answers above.

Kim Williams
United Kingdom St Just Cornwall

Antistone wrote: I believe we can calculate this probability using Bayes' Theorem. P(AB) = P(BA) * P(A) / P(B) You want to know the probability that the fourth card is red, given that you revealed green, green, and yellow. So let A = the event that the new card is red B = the event that the first three cards you reveal are green, green, and yellow Then P(A) = 20% Initially, we assume all 5 colors are equally likely P(BA) = 25%Given that the new card was red, the odds that you would NOT see a red card after revealing 3 out of 4 is 25% (the red card had a 1/4 chance of being the last card) P(B) seems more difficult to calculate. I think the best option here is to sum P(BA)*P(A) for all possible colors Red, blue, or black: P(BA) = 25%, as described above Yellow: P(BA) = 50% (there's a 2/4 chance that one of the two yellow cards would be last) Green: P(BA) = 75% (there's a 3/4 chance that one of the three green cards would be last) That means P(B) = 60%*25% + 20%*50% + 20%*75% = 40% P(B) = 40%So now we can apply Bayes' Theorem to calculate P(AB), the probability that the new card is red given that you revealed green, green, and yellow. P(AB) = P(BA) * P(A) / P(B) = 25% * 20% / 40% = 12.5%The probability of the fourth card being red has dropped from 20% to 12.5% because of your knowledge of the first three cards. On the other hand, if we consider the probability of the last card being green... P(A) = 20% P(BA) = 75% P(B) = 40% P(AB) = 75% * 20% / 40% = 37.5%Green is definitely a better guess (assuming that all 5 colors were equally probable initially). (As a sanity check, if you repeat that math for all 5 colors, you'll find that the probabilities do, in fact, add up to 1.)
Thank you so much!
This amounts to the same as the ratios my son's programme worked out  so I'm happy Great to see the 'proper' maths as my son was just calculating all the possibilities and added them up.
In the end the fourth card was in actuality yellow  and we'll never know if that was a 'new' yellow, or just a repeat of our previous one. Definitely not red

Bryce C
United States
Let's play together!  Legendary DXP
I don't tell people what to do on their turn, I might as well be playing by myself.

You didn't tell us you were using Wolverine! That's not fair!



Well for the infinite deck your intuitive answer is correct without working out the correct answer.
There is some probability (let's call it p) that you're looking at the three cards you saw before and some probability (let's call it q) that you're not. Both of these things are possible so both of those probabilities are above zero.
Supposing an infinite deck with an even spread of colours, the odds of each outcome are as follows
Red = 0.25p + 0q Blue = 0.25p + 0q Green = 0.25p + 0.5q Yellow = 0.25p + 0.5q
Edit: Reading other people's answers it's apparently that 0.5q isn't quite right. I think it should be 0.66q for green and 0.33q for yellow? Doesn't change my core point though
It should be obvious that if p and q are both above 0 then Green and Yellow are higher than Red and Blue  without needing to know how much higher.
That being said, you don't have an infinite deck! Imagine a situation where the deck only contains 2 of each colour of card. Then the odds become the following
Red = 0.4q Blue = 0.4q Green = 0 Yellow = 0.2q + 1p
Not so obvious! So while your intuition was definitely correct for an infinite deck, it becomes a more interesting problem with a smaller deck because if you've seen the same three cards again the probabilities of the different outcomes aren't even.
Without sitting and crunching the numbers, the best lazy strategy is to pick Yellow. Since the deck is quite big so approaching the infinite problem where Yellow and Green outperform Red and Blue  but also in a finite deck Yellow is better than Green since you've seen more Yellow cards being removed from the deck
Bonus question for the people crunching numbers: What deck size is the tipping point between "always pick yellow" and "pick red or blue"?

Kim Williams
United Kingdom St Just Cornwall

x_equals_speed wrote:
Bonus question for the people crunching numbers: What deck size is the tipping point between "always pick yellow" and "pick red or blue"?
Yes that is an interesting question. Our deck had approx 100 cards in it, (my husband reckoned, I haven't checked) and there wasn't a huge amount of discarded cards to potentially take into account.
I can't crunch the numbers, but my gut instinct is that the fact that getting a green was three times more likely than a red in an infinite deck, would mean that even after reducing the odds slightly because you were pulling a third green out of maybe potentially 20, it was still much more likely than a red.
I've also never checked how even the colours are  it may be erroneous to assume a roughly equal split.
But it quickly became not about the exact situation, and more about how our intuition about statistics and revealed information can be weird. (It even spun off into going through the Monty Hall problem with my children  my 12 year old daughter (who loves maths) was very unhappy with that one)

Michael Green
United Kingdom

As a statistician, I am so loving this discussion

Jeremy Lennert
United States California

x_equals_speed wrote: Bonus question for the people crunching numbers: What deck size is the tipping point between "always pick yellow" and "pick red or blue"? Since the visible cards give yellow a 2:1 advantage in a uniform deck, I believe the crossover point is simply when another color is at least twice as common as yellow in the deck.
Similarly, the crossover for green is when another color is 3 times as common in the remaining draw pile (or when yellow is 1.5 times as common).
P(BA) isn't changing, and P(B) changes but doesn't depend on the color you're guessing, so you just need to mess with P(A) until it outweighs P(BA).



I had to work it through to convince myself of that, but crunching it myself it's easier to see why. This is for a deck that started with 4 of each colour (so now contains 3 yellow and 2 green, giving the 1.5x as common condition).
...for A is "the new card is green"...
P(AB) = P(BA) * P(A) / P(B)
P(BA) = 0.75 P(A) = 0.1176 P(B) = 0.25 * 0.7059 + 0.5 * 0.1765 + 0.75 * 0.1176 = 0.353
P(AB) = 0.75 * 0.1176 / 0.353 = 0.25
...for A is "the new card is yellow"...
P(AB) = P(BA) * P(A) / P(B)
P(BA) = 0.5 P(A) = 0.1765 P(B) = 0.25 * 0.7059 + 0.5 * 0.1765 + 0.75 * 0.1176 = 0.353
P(AB) = 0.5 * 0.1765 / 0.353 = 0.25
Yup, can't argue with that.


