Maybe I'm missing something, but the "hard" part of this problem is figuring on the trick. Once you know that, it becomes relatively easy – and you can't use a program to figure out the trick.
The problem isn't difficult without programming. It's the programming that's elegant because it's an interesting way to solve the program, by expressing their statements as functions and using the know and tell functions. It's actually really great how the logic was translated in code, almost like a direct translation from English to Python. Now that I know how to write the program, if the puzzle were to get rapidly more complex, say with 20 different statements of moderate complexity, I feel confident I could solve it with a program whereas I might struggle with pencil and paper.
If you know someone else doesn't know, that just gives you more knowledge you yourself can use.
For the "hardest puzzle", on each day everyone learns that no one was able to figure out the solution the day before. Because of this, a person knows that for a possible number of blue-eyed people to be valid, a person who sees one less blue eyed person than that, must have been unable to figure it out on the previous day.
I find the problems with puzzles like these is not the rules, but the ridiculously contrived situations. Why do these entities that function like inert logic gates have to be human? It means that the question has to have silly rule placed on silly rule in order to keep the contrived situation afloat. It means I end up thinking of ways for the mute, inert people to free themselves from the island (who is feeding them? Are there trees to build a raft? etc), rather than 'play by the rules'.
Sentient immortal mute beings of pure logic that do not possess the capability of traversing the ocean are people too!
I get your point. Still, it's hard to define the puzzle in terms of not-people. Maybe you could call them intelligent robots -- people might find it easier to picture mute robots with hats.
Not to be confused with the "Hardest Logic Puzzle Ever," about identifying a truth telling god, a lying god, and a random oracle, none of whom even speak your language.
The "hard" part of any programming problem is to figure out what the program has to do. The machine can't tell you the correct answer without you giving it the correct instructions.
Its understanding what the question actually means when it says things like 'Bernard: At first I don't know when Cheryl's birthday is, but I know now.' ... this is actually a cryptic coding of the rules of the puzzle.
If you properly understand those rules and convert them to code (as in the OP) then searching the possible answers for a match is trivial.
I think one of the things that trips people up with puzzles like this (including the one mentioned in https://news.ycombinator.com/item?id=9437483 ) is that knowledge of lack of information is itself information, a point that isn't used very often; if someone tells you they don't know something, you are likely to see it as simply a lack of knowledge, and not as a piece of information that could be combined with the information you have. It somewhat reminds me of that quote about "known knowns" and "known unknowns"...
It's Singapore English. Instead of using tenses, you put a phrase expressing time at the beginning of a clause, a feature borrowed from Chinese. "At first" sets the time and topic of the following clause. Having spent some time in Singapore and HK, I found the Chinese-flavored English to be immediately clear. Actually, if you just guess to substitute the correct verb tense (don't -> didn't), it seems clear to me in ordinary English as well, and I'm not sure where the confusion lies.
The Singaporean government doesn't think Singapore English is a valid thing and wants everyone to learn "good" English. The Singaporean upper class is, as usual, on the government's side, and will complain about the poor English education in their country. That's fine for them, but please be aware that when you say "this is bad English" you are making a cultural and class-based judgment. What you really mean is the math question uses a way of expressing time that is familiar to them but not familiar to you.
For outsiders, there are two elements to the puzzle: the encoding of the logic problem and the logic problem itself.
People might very well be able to solve even fairly complex logic problems without having been exposed to this tradition of encoding such problems.
The problem is stated as three persons having an odd, but casual conversation. To outsider that's all they're doing and to those the problem is impenetrable. Insiders, however, immediately recognise the informal protocol of logic quizzes that this is not a random casual conversation, it is carefully written to encode just enough information to be solvable as a logic problem. These insiders know to carefully extract (decode) this information. Only then do they solve the logic problem.
The "dishonesty" of the problem, which is confusing to people expecting the problem to be stated honestly, is that the conversation in the problem is entirely contrived, there is no way is would ever happened as part of a real world exchange about birthdays. This is fine for the intendeded reader, school kids trained in this protocol, but in "going viral" it went to a lot of unintended recipients.
This is exactly why I find these kinds of puzzles infuriating. It always hinges on some contrived, bullshit "trick" which has nothing to do with solving real problems.
It's really not a trick. You simply take all the knowledge you are given and (this is important) don't make any additional assumptions or guesses or even really think of the participants as human, and.solve it like a math problem.
Yeah. I'm completely unable to do any of the stereotypical interview question puzzles which hinge on an "outside the box" trick, but I had no trouble recognizing this as a straightforward problem that you just work through.
I think if you were actually tasked with finding a plainer way to express the fact, you would have no trouble.
When Albert says I don't know when Cheryl's birthday is, but I know that Bernard does not know too, consider There are no unique days in the month I was told.
Informally, note the difference of order. If Albert said "I was told the Birthday is in July", that would be, say, first order. The plain version I provide is a logical statement about the months and dates, a second order statement. But the cryptic version is a statement about what (second-order) statements Bernard can make, so third order. Hence, cryptic.
Trust me, its cryptic to most people, and that's why this puzzle has gone viral round the world in an omg-singapore-schoolkids-can-do-this-insane-puzzle kind of way.
Why do you suspect the crypticness of the puzzle's language is the problem, rather than the fact that a large portion of people haven't studied basic logic and are thus unable to complete basic logic puzzles?
It's not just a basic logic problem - it's a language translation into a logic problem problem. You have to 'get' that is what you're dealing with.
Incidentally, I get a similar feeling from these puzzles that I get from code questions or examples where every variable or function is named 'a' or 'b' or 'foo' or 'bar'.
(aaand I just had a mini-epiphany of sorts that when I see those types of programming puzzles I should probably write them out and substitute the variable names as I go....)
Firstly, someone reading the puzzle needs to grok that some of the day-numbers are unique across the months (e.g 18) and some are not (14). Then they need to grasp the basic dynamic on the situation, e.g. that if Cheryl's birthday had been May 19 then Bernard would have known straight away.
If you dont initially grasp the above then Albert's initial declaration "I don't know when Cheryl's birthday is" just seems to be a redundant statement that doesn't offer any information. And thats just the first hurdle of the puzzle.
A lot of people hate maths-questions-stated-as-stories, even simple ones ("There are several chickens and rabbits in a cage (with no other types of animals). There are 72 heads and 200 feet inside the cage. How many chickens are there, and how many rabbits?" etc etc) so to people like that, this Cheryl-birthday problem initialy presents as hopelessly cryptic.
Interesting. As a native English speaker, I didn't even consider "before Cheryl had told me, I did not know" as a possible interpretation, just from the way the conversation flows but also because it goes without saying and wouldn't add anything.
In the context of Albert's statement though, it couldn't mean that - Albert's statement is saying that Bernard does not have enough information to determine the date just based on what Cheryl told him, so in saying "at first I did not know, but now I know", the only difference between "at first" and "now" is Albert speaking.
So Bernard's comment could only mean, "Based on what Cheryl told me, I did not know what the birthday was, but given the extra information I have as a result of Albert's statement, now I know"
It took me a bit to figure out that the third statement was meant to be Albert expressing his confidence that Bernard didn't know the answer and not Albert inducing from Bernard's silence that Bernard didn't know the answer. The latter implies something like the Python code below, which will end up giving August 17th as an answer instead:
def statement3(date):
possible_dates = tell(Month(date))
return (not know(possible_dates)
and not know(filter(lambda x : not know(x),
[tell(Day(d)) for d in possible_dates])))
Assuming that the problem is posed and understood as an artificial puzzle (rather than a real scenario with real people), what reason would there be to question how they know? Of course you're supposed to assume they know. It's a puzzle, and someone is telling you precisely what you're to assume.
On the contrary, there are many unspoken things one must assume to solve this puzzle "correctly"; that Albert and Bernard are rational, honest, cooperating, and have a certain penchant for communicating novel inferences they make instead of just blurting out "we don't know" out of boredom, laziness, or frustration.
Logic puzzles where one must assume so much are not about pure logic. They are "logic" puzzles. If you aren't made aware of the assumptions that were made in building the puzzle, the solution you arrive at may not match the "logical" one.
Is it really such a big leap to assume that fictional people in a logic puzzle or riddle are telling the truth? I don't think so. To me, it's very clear that the names of the people are chosen arbitrarily (with first letters corresponding to the first letters of the alphabet) and that the things they are saying are simply a way to convey the logical constraints to the reader. It's very obvious to me that the fictional people, their names, and the fact that they are speaking aren't actually relevant to the logic puzzle.