Question: There are four red cards and four blue cards. The host takes either of them first, add any two cards (two cards on each person's head) to the forehead of A, B, and C respectively)
The three people A, B, and C can see the cards on the foreheads of the other two. After reading the cards, let them guess what color of cards are on their foreheads,
A says no, B says no, C says no, and then a says yes.
Ask how to make a decision and how a knows it. How can I implement it with a program?
Idea: The purpose is to export the color of A. Since a first looks at B and C, we should first assume the color of B and C and then derive
Analysis: the possible cards on the head are BB, RR, Rb (blue, red)
A: I do not know whether the color in B and C is equal to 4.
B: I don't know if the colors in A and C are not equal to 4.
C: I don't know if the colors in A and B are not equal to 4.
Process: 1> B: RR (bb) C: RR (bb) A certainly knows, so it does not meet the requirements
2>
B: RR (bb) C: BB (RR) A does not know, because B does not know, C does not know, so a can only obtain Rb
3> B: RR C: RB
C does not know-> A is not rr a. If BB-> C is determined by a and B, it can know that it is RB, but C does not know it. Therefore, it is excluded that bb A = Rb
B: BB C: RB: Likewise, A = Rb
B: RB C: RR likewise a = Rb
B: RB C: BB: Likewise, A = Rb
4> B: rb c: RB. If a = rr B = rb c, you can guess that B cannot know that B is RB. Therefore, C can guess that c = RB.
If a = bb B = RB, C can guess that it is equal to RB.
Since rr bb is excluded from a, only a = RB can be used.