Hello, World
m.whitehouse.gov
m.whitehouse.gov
Bob always chooses the same as his flip, Alice always chooses the opposite of her flip.
B A
H H - Bob chooses heads, Win
H T - Alice chooses heads, Win
T H - Alice chooses tails, Win
T T - Bob chooses tails, WinI was going to post a hint rather than the solution, but you beat me to the punch.
A_coin B_coin A_guess B_guess
H H ? ?
H T ? ?
T H ? ?
T T ? ?
Then I tried to fill in the guesses, given that A_guess has to be based on B_coin and vice-versa. After making Alice guess the same as her coin flip, since that's a simple thing to try first, it was clear that Bob had to guess the opposite of his coin flip for each row to have exactly one correct match.Then I realized if one took the "guess same" strategy and the other took the "guess opposite" strategy that would cover the bases.
The answer just appeared with zero awareness of any effort or reasoning that may have lead to it -- the only reasoning I perceived was in verifying the solution. So I got curious as to how intuition could solve this problem roughly on its own, or with so little help from conscious reasoning that I didn't notice it.
From the replies it seems there are two key realizations that combined could lead directly to the solution, and both realizations strike me as things that intuition would be good at noticing. The first is that each player likely has deterministic rule that is dependent on their coin, so there are only two candidate strategies per player. And the second is that the players likely have different strategies.
This seems a bit awkward, but information theory "guessing" is called "error correction", and parity-checking is the simplest and by far most common strategy. (Advanced algorithms are fancier multidimensional parity computations) So, their two guesses are "same" and "different" (aka parity 0 and 1). A and B each are allocated one of the two strategyGuesses, and translate observedCoin+strategyGuess=hiddenCoinGuess
I have to say I feel somewhat inadequate coming to the answer experimentally as opposed to what others did here.
If a fixed strategy can't work, then the guesses must be decided dynamically. At the time the guess is made, only one bit of information (their own flip) is available to each participant, so each guess has to be based on that. With one bit of information, you could only choose two things: do the same, or do the inverse. The correct, asymmetric pair of strategies popped into my head at this point, and a quick truth table check confirmed it.
Both of them sticking to prior choice was shown not to work, leaving 8 permutations to investigate at most. But it is easier than that.
I started by assuming Alice will guess her flip result. Looking at the truth table
A B
h h :-)
h t :-(
t h :-(
t t :-)
This means the only losing possibilities are when the coins are different. Therefore Bob must guess the opposite of his flip result, to ensure no losing possibilities at all.So knowing that, I just looked for what extra, non-obvious piece of information A and B had. It seems impossible to guess what the results of a coin-flip are in another room. But the players also know the result of their own flip, and so basing a strategy on that extra info is certainly going to be the answer. From there, since there are so few combinations of such a strategy, getting the right answer is pretty trivial.
I like this brain teaser (and I suspect the reason that Felton likes it as well) because it shows this general pattern for brain teasers very clearly. The "extra" piece of information is pretty obvious with a moments thought. And once you have it, the number of possible strategies using it is small enough that you can see the correct one quickly.
A lot of other brain teasers require a lot of pen and paper work even after you've guessed the "trick" in order to work through all the possiblities. So this is sort of a nice, boiled down "essence du brainteaser".
For Alice to lose, Bob would have to have flipped heads. Now Bob knows, because he has discussed strategy with Alice prior to doing the flips that either Alice flipped tails, in which case she has won, or she has flipped heads, in which case she has lost. But Bob can then bet on heads, in which case he knows that he wins if Alice loses.
That was my way of reasoning things anyhow. As you can see from the other responses, there are many different ways of arriving at the right answer.
\exists f,g: \forall a,b: (f(b)=a) | (g(a)=b)
where f,g are the guesses and a,b are the flips. Each guess is a function of the information available to the respective player -- the outcome of his own coin flip. There's only 4 unary boolean functions: f,g \in {true,false,id,not}
The constant functions are out and order doesn't matter, so we're left with {(id,not),(id,id),(not,not)}
Here I just tried (id,not) first, but 3 choices are easy to check exhaustively.First, I assume there is an answer, and at least a moderately interesting answer.
There is no way they can communicate information post-flip, therefore they must be able to cover every possible option.
They cannot cover every possible option by deciding what to write in advance, therefore they must decide what to write based on the flip. In fact, they must both decide based on the flip or they will not gain anything.
If you decide what to write based on the flip, there are only two real choices per player: write the same as what you got, or write the other one.
That leaves you with 3 overall options. Both taking the same of these choices won't work (I skipped over the calculation because they're not interesting solutions), so they must agree to take opposite choices.
When I re-read the description and said "oh, they only have to have one correct answer between them," it was just like, "how can I make sure that when Alice is wrong then Bob is right?". The solution followed about a second later, "well if Alice guesses the same as her flip, maybe Bob guesses the opposite of his", without any logic tables or further reasoning or anything. Then I drew up the 4 possible coin flips and the resulting predictions and wins, to prove that it was correct, just in case I was somehow missing something.
Suppose Alice got Heads. Say she guesses Heads. Then when Bob gets Heads they win. When Bob gets Tails Alice is wrong so Bob needs to guess Heads when he gets Tails.
Flip the scenario around when Alice gets Tails and you get the whole strategy
I started with a truth table as well. It's pretty easy to show that if Alice (or without loss of generality Bob) uses a fixed "always guess H" or "always guess T" strategy, that wins in two cases, but in the other two cases Bob has no way to reliably win. For instance, if Alice always guesses H, then two cases become wins:
A B
H H W
H T ?
T H W
T T ?
But in the other two cases, Bob has the same T each time, so he doesn't have enough information to distinguish those cases, and thus he can't reliably guess correctly.So Alice needs to use a strategy that depends on her flip. There are only two such strategies that don't trivially reduce to a constant guess: guess what you flip or guess the opposite of what you flip. Going with the former, where Alice guesses what she flips:
A B
H H W
H T ?
T H ?
T T W
From this, clearly if Bob guesses the opposite of what he flips, someone wins in all four cases.The only other solution is to reverse the two: Alice guesses the opposite of what she flips, and Bob guesses what he flips.
This seems like a nice warm-up for other protocols that depend on agreed-upon strategy but not a secure channel for direct communication, such as Diffie Hellman or the Socialist Millionare Problem.
The next level is: Eve joins the game, and the coin gets another side.
A Alice's coin
Ac Alice's choice
B Ben's coin
Bc Ben's choice
They win if A's and Bc's OR B's and Ac's are the same A Ac B Bc
T T T T W
H T T T W
T H T T W
H H T T L
T T H T W
H T H T L
T H H T W
H H H T W
T T T H W
H T T H W
T H T H L
H H T H W
T T H H L
H T H H W
T H H H W
H H H H W
It's easier to check for when they are losing: A Ac B Bc
H H T T |they both stick to their choices
H T H T |they both flip
T H T H |they both flip
T T H H |they stick
So the winning strategy is if one of them sticks to his choice and other flips it's choice.EDIT: To be clear, I am not downvoting because I think that this comment is unconstructive; clearly it is a useful contribution. At least as good as, and probably better than, having it appear later would be having more whitespace between the spoiler warning and the actual spoiler.
Another fun problem, probably better known, is sequential hat guessing: take 100 people in a line, arranged so that each person can see everyone in front of them, but no-one can see any of the people behind them. Everyone is given either a red or black hat to wear, but no one can see the color of their own hat, or the hat of anyone behind them. So the person at the back of the line can see everyone's hat but their own, the next person can see everyone's hat except the first person and their own, etc.
Now starting with the back of the line, each person is asked to publicly guess the color of their hat. The participants are allowed to agree upon a strategy, how many people can they guarantee guess correctly?
Things get crazy if you allow an infinite countable line of people, and put ear-muffs on anyone so that no one gets to hear anyone else's guess. Surprisingly, you can still save almost everyone (if you allow the axiom of choice).
Usually problems on "countable" structures need only finite memory (to process infinite streaming input), so this problem is rather misleading.
100 prisoners are each assigned a black or white hat, at random. As always, they cannot communicate after the hats are assigned. Then they are shown each other. None sees own hat, everyone sees everyone elses hat. Then they are led into separate rooms and each guesses their own hat color.
They win only if everybody guesses correctly. What strategy maximizes the probability of that event?
I wouldn't be surprised if this is optimal, but I also wouldn't be surprised if it's not.
Alice guesses that Bob's coin is the same as hers. Bob guesses that Alice's coin is the opposite to hers.
It's fairly straightforward. I'd like to know the computer science angle to this though.
EDIT: From the computer science that I know :
We need to find an invariant that all permutations of coin flips always satisify. Intuition tells us that Alice's coin might be the same as Bob or vice versa :
If you construct a truth table :
Alice Bob Alice's Coin same as bob Bob's opposite to Alice
H H YES NO
T T YES NO
H T NO YES
T H NO YES
The expression : Alice's coin same as Bob || Bob's opposite to Alice
Always evaluates to true. So Alice can guess her flip and Bob can guess the opposite.But what if we had Alice , Bob and George and atleast one of them had to get the other two right ?
Is there a general pattern ?
Alice Bob George
H H H
H H T
H T H
H T T
T H H
T H T
T T H
T T T
Will try and figure it out over dinner :D .Someone didn't learn about the halting problem :-)
Note: An open problem. You can look up cryptogenography for current results.
I wouldn't be shocked if W had written some excel macros, though. Even less so if Romney had.
Alice always guessing the same as what she flips and Bob always guessing different.
But - my question is this: Are there any other possible solutions to this puzzle?
Either way, I'm pretty sure this is just an Illuminati code plot from the White House to find the world's top coders and recruit them into some CIA program.
I'm more interested to know what people think about Obama's proselytizing of computer science. It seems like a great move to me. Is he going about this in a smart way? Do you think he'll get the results that he's looking for?
A says B result is the same as A result. B says A result is different from B result,
so that A covers (H,H) and (T,T), B covers (H,T) and (T, H), so always A or B is true, so they always win.
Raise campaign finance from the wealthy so that they can make it past the lesterland election[0].
Now that you have a war chest and are in the general election you just need to raise more capital from the 0.1%, buy more advertising, hire the best staff in Washington and bam!
I know this is not the coding question at hand, but a more important question on how unequal our political system is and I couldn't forgo the opportunity to ever so gently show the obvious reality - once you past the lesterland wealthy elite and get their backing, winning is only a matter of time.
I stand corrected, very nice puzzle :)
"Antitrust" is a bogus concept.
It is never and was never in the public interest.
It is also a massive violation of the rights of companies and their shareholders.
Consider that if Windows/IE were really that bad, people would have just switched more readily to a Microsoft competitor. Desktop-quality Linux would have come about/come about sooner, or something equivalent.
This is an example of the point that there is no such thing as a monopoly unless it's created through legal channels (i.e. is granted by the government).
There is no business that can't be competed against with sufficient capital.
And the global economy accumulates spare capital over time (because in the net, the species produces more than it consumes).
Even "natural monopolies" are a function of a mistaken way to implement property rights, as opposed to being "natural." Because you can always build underneath or around whatever is already there.
edit: This is a serious intellectual comment that deserves to be read. It also matters a lot for our industry. Consider Google in Europe right now.
Consider last-mile telephone lines. It's wasteful to have ten companies each spend billions of dollars digging up the same roads to lay the same cables - and it's a nearly-impossible barrier to entry for new competitors. Sure, anything is possible with "sufficient capital", but fundamentally it's an inefficient waste of time and investor money to recreate a service that already exists, and the investors will be correspondingly scarce.
Most countries have enacted legislation enforcing fairly shared use of such lines (breaking up monopolies in the process) because cooperation is fundamentally more efficient than competition as effort is not wasted in duplication.
As a result, the ISP/telco market in civilized countries has since escaped from that stagnant local maxima with its high barrier-of-entry, to a more agile, more competitive state where smaller players have a fair chance of competing. I'm not sure if this includes the USA though (c.f. Comcast/TWC merger complaints, single-ISP areas, the "Worst company in america" award, unending complaints on /r/technology &c).
Believe me, people would do that if they were getting sufficiently screwed by telcos and if it were legal.
Actually, the former condition is already satisfied, but the latter is (basically) not.
Though there have been lots of municipal broadband efforts, which is a point in my favor, here. The telcos fight them tooth and nail using the legal system.
That is just another example of a legal monopoly (as opposed to a natural monopoly---no such thing).
Why not extend such egality to all citizens? And why do people have to get "screwed by telcos" first before it can happen?
Arbitrary government exercise of power is incredibly dangerous.
http://birdhouse.org/beos/byte/30-bootloader/
"[...] Be was engaged in enthusiastic discussions with Dell, Compaq, Micron, and Hitachi. Taken together, pre-installation arrangements with vendors of this magnitude could have had a major impact on the future of Be and BeOS. But of the four, only Hitachi actually shipped a machine with BeOS pre-installed. The rest apparently backed off after a closer reading of the fine print in their Microsoft Windows License agreements. Hitachi did ship a line of machines (the Flora Prius) with BeOS pre-installed, but made changes to the bootloader -- rendering BeOS invisible to the consumer -- before shipping. Apparently, Hitachi received a little visit from Microsoft just before shipping the Flora Prius, and were reminded of the terms of the license."
There are no specific examples that will get you out of this.
Actually, it Windows already kinda does suck, which is why so many people (even companies) use Apple. And there are lots of other alternative OSs.
So you're saying that no amount of evidence to the contrary will change your mind?
I mean, you can keep taking it out one level, and competition can happen there. For instance: Can't compete due to OEM agreements with MS? Have to get an OEM to capitulate, or start your own OEM, or find another way to get your competing OS on machines. There is no specific example that will make the argument that competition is impossible go through.
Why didn't you try to understand what I said instead of taking the cheapest opportunity to pick on it?
That is what Apple does, for instance.
You can't dismiss evidence ahead of time because you're convinced your theory is true.
this isn't a cheap opportunity to pick at your argument, it's a huge red flag that you have a fundamental error in your reasoning.
>I mean, you can keep taking it out one level, and competition can happen there. For instance: Can't compete due to OEM agreements with MS? Have to get an OEM to capitulate, or start your own OEM, or find another way to get your competing OS on machines. There is no specific example that will make the argument that competition is impossible go through.
Fine - but this argument doesn't model reality, and this is where the relevance of evidence comes in: many times competition is theoretically possible but won't occur since no one wants to risk a lot of capital and time and effort on what will likely be an unsuccessful venture.
So if an unregulated Microsoft manages to lean on their competitors enough that people don't want to try competing anymore, then competition is still possible, but without regulation it won't occur.
There is no possible counter-evidence. You'd say the same thing about lots of things---for example, that the Earth is spherical.
So you are mistaken here about how epistemology works.
> many times competition is theoretically possible but won't occur since no one wants to risk a lot of capital and time and effort on what will likely be an unsuccessful venture.
That isn't borne out in reality. It's very easy to compete against a shitty product with a superior product, and there is plenty of capital to compete with any product that exists today.
> So if an unregulated Microsoft manages to lean on their competitors enough that people don't want to try competing anymore
What does it mean to "lean on competitors"? Nothing. It's meaningless. There is literally nothing a company can do to "lean on" competitors unless they use the law to do it. They can lean on other market participants---e.g., OEMs, But you can always get around that because you can start a competing OEM or get an OEM to capitulate. That's why I say I can always take the argument out one level.
I'm most likely not going to continue responding. I will if you ask a question out of curiosity, but I'm not interested in "aruging" with you further.
The only strength that is strong enough to strangle competitors at birth is the long arm of the law.
In other words, the only way to keep out competition is to use force.
That is precisely what is disallowed in a free market, i.e., in a rights-respection nation.
Those are, in effect, government created. I am totally against that. I am totally against government passing laws to favor certain people over others, treating people unequally.
The main thing you can do with 99% market share is lose it.
edit: Actually, to elaborate...
A better way to put it: I go from the ground up, not the top down.
Most ideologies go top-down, which is utterly futile and is why people believe there is a dichotomy between the moral and the practical, i.e., principles and pragmatism.
Going top-down produces ideologies that are floating abstractions. Castles in the air. They end up being more constricting then they are empowering. Nearly every ideology you have ever heard of is like this. That is why you reject ideology.
If you do it from the ground up, you get an entirely different result.
If you want further reading, here [1] are some short excerpts about antitrust laws from one of my favorite authors.
The biggest drawback that I saw from the DOJ decision was that Microsoft was not allowed to innovate. Windows 98 and Active Desktop can be considered an early precursor to today's web applications like Chrome packaged apps and Firefox apps. How might the application landscape look today if XP were firmly rooted in the concept of web applications rather than native applications? The decision against Microsoft actually slowed them down and allowed them to slowly outlast their competitors.
Instead of fighting a browser war, Netscape might have pivoted and created a Chrome OS like operating system that ran on top of Windows, Linux, and Mac OS. Google might have become known for creating a rich set of web-centric APIs that Netscape OS leveraged.
Instead, Netscape got stuck in an entrenched losing battle over a product. It was myopia that defeated them. The DOJ decision delayed the inevitable and it caused Netscape to waste resources thinking they had a chance in a "fair" fight. The Web 2.0 revolution was poised to take place on the desktop rather than in the browser. As a result, I think we all have suffered a 15 year setback.
I feel in the same way that an EU decision against Google won't correct any injustices, but it might stifle innovation; and not just innovation from Google, but its competitors as well.
Wasn't the Dictator of Singapore earlier with his Sudoku?
This is a ridiculous stunt, and it sets the wrong accents. Coding is being hyped while the people who actually keep us alive and in good condition work 3 jobs and can't afford health insurance.
Meantime, Obama destroys the Constitution and betrays the People of the U.S. to the NSA and their ilk like none did before. I think I'm getting sick.