4 is pretty simple if you look at all possibilities.
Program A will receive a 0 or a 1 and will guess the opposite of this value.
Program B will receive a 0 or a 1 and will guess this same value.
So, you have 4 possibilities:
(A/B is the bit received, a/b is the guess, you 'win' if b == A || a == B) (In other words, if B's guess is equal to what A received, or vice versa)
A|B|a|b
0|0|1|0 (b == A)
0|1|1|1 (a == B)
1|0|0|0 (a == B)
1|1|0|1 (b == A)
Another way to think of it is that A is guessing that they will receive different values, and B is guessing that they will receive the same value. One must be right.
Program A will receive a 0 or a 1 and will guess the opposite of this value.
Program B will receive a 0 or a 1 and will guess this same value.
So, you have 4 possibilities:
(A/B is the bit received, a/b is the guess, you 'win' if b == A || a == B) (In other words, if B's guess is equal to what A received, or vice versa)
A|B|a|b
0|0|1|0 (b == A)
0|1|1|1 (a == B)
1|0|0|0 (a == B)
1|1|0|1 (b == A)
Another way to think of it is that A is guessing that they will receive different values, and B is guessing that they will receive the same value. One must be right.