3 ms·
Can you explain answer 4 and 5 please? Thanks.
by infinitone 11y ago
Can you explain answer 4 and 5 please?
Thanks.
- green7ea 11y agoNumber 4 is pretty cool because the programs use the fact that they know how the other program guesses to make sure they win. If I'm Program 1 and I see a 0, I will guess 0. If Program 2 sees a 0, Program 1 guessed correctly and it doesn't matter what he guessed. If Program 2 sees a 1, he will guess the opposite (0) and this means that Program 1 was wrong but Program 2 was right. If Program 1 sees a 1, he guesses 1. If Program 2 sees a 1, Program 1 is correct. If Program 2 sees a 0, he guesses 1 and is correct. The above is a truthtable in words that shows they are always right. For number 5, I translated the binary numbers to decimal and used an ASCII table to convert them to ')87*;+xorXOR'. This is a different answer than grandparent. The following C++ code does the conversion: http://pastebin.com/ThxdHHwu http://pastebin.com/ThxdHHwu
- bryondowd 11y ago4 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.