

Two logic puzzles - RiderOfGiraffes
http://www.nickyee.com/index-puzzles.html

======
RiderOfGiraffes
WARNING: SPOILERS FOLLOW

If you want to read on, do so. If people up-mod this comment then it will stay
at the top.

In case you don't want me to get the karma, up-mod it anyway, and down-mod the
other comment to balance it out. Here's the link:

<http://news.ycombinator.com/item?id=1013881>

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

------
huangm
1\. A puts amulet in the safe, puts lock on it, sends to B. B puts lock on it,
sends back to A. A unlocks his lock and sends it back to B. B unlocks and
receives the amulet.

2\. Take 20 coins aside, and flip them - this is one group. Take the 80
remaining coins - this is the second group. If there were X (0 \leq X \leq 20)
queens in the first group, then there were 20-X queens in the second group.
Since we flip the 20 coins in the first group, there are now 20-X queens in
the first group as well.

~~~
eggoa
I guess that's the right answer, but it's not really satisfying. If the
servants can walk off with the safe to crack it at their leisure, how is it
secure?

~~~
huangm
The moral here is that the more colorful you try to make your logic puzzle,
the more implausible the correct solution will be.

------
jacquesm
I used to think that I was pretty good at puzzles like this.

That is, until I met a girl that just simply aced them, one after the other,
and in record time at that.

It's the first time that I ran into very solid proof that brains definitely
are not created equal, I've never met anybody in my life that even came close
to that level of problem solving ability. It's akin to the difference between
a chess grand-master and someone that just plays a half decent game of chess,
some people operate on a different plane altogether, they are so good at
attacking a problem in parallel from all sides at once that what seems
confounding to one person is a walk in the park for them.

If you solve the second puzzle in 5 seconds or so because you simply 'see' the
solution then you fall in to that group, consider yourself a very lucky
person, I wonder how rare such talent really is.

~~~
riffraff
I was thinking "eh, just like my brother used to", so I told him the problems
and he solved both in about 5 mins (although the first one the same way I did,
it seems trivial if you can ybpx gur fnzr fnsr jvgu obgu ybpxf ng gur fnzr
gvzr but also seems slightly wrong)

------
tome
Did you know there's a puzzle called "The Hardest Logic Puzzle Ever"?

<http://en.wikipedia.org/wiki/The_Hardest_Logic_Puzzle_Ever>

I extended it to the general case!

[http://www.srcf.ucam.org/~te233/maths/puzzles/evenharder.htm...](http://www.srcf.ucam.org/~te233/maths/puzzles/evenharder.html)

~~~
RiderOfGiraffes
I agree that they are difficult, but for me, they fall into the category of:

    
    
      "I can probably solve these by long and convoluted
       means, but I suspect the solution is neither clean
       nor elegant and, to be frank, I can no longer care."
    

The beauty of the 100 coins problem is that the solution, once seen, is clean,
simple and elegant, and it is possible to reason to it - it doesn't require
complete inspiration from nowhere.

That's why I liked it so much. YMMV.

~~~
btilly
Actually the solution to the 3 god version is clean and elegant, and long and
convoluted reasoning doesn't shed any light on it.

------
jbm
My solution for #1 - not sure if it is correct. I didn't expect that two locks
could fit in the clasp.

Person #2 sends the safe back to Person #1. It has nothing in it.

Person #1 locks his own safe to the safe of person #2, making sure the clasp
of his safe is over the latch pin of the second safe. Again he sends it back
with nothing in it.

Person #2 repeats this; now you have two safes locked together (with the latch
pin being on top of opposite clasps). He sends the safe back to person #1.

Person #1 unlocks his lock, puts the amulet inside, and locks it again. He
sends it back.

Person #2 unlocks the other side, and now has both safes, plus the amulet.

------
vlad
The description says you have five minutes to complete the task. So just move
any ten coins to a new pile. Continue moving one coin at a time while asking
if you have completed the task. You will have to move at most eighty coins
after the initial ten. Since you have five minutes to do this, you'll have
about 3-4 seconds per coin for the captor to reply if you've solved it yet.

The solution someone posted to flip each coin after picking out twenty is
faster but flawed; it would be too easy for a nervous and blinded person to
flip the same coin twice. The best solution would be to flip each coin as it's
drawn from the initial set of one hundred.

------
midnightmonster
I got #2, and I have a solution for #1, but I don't think it's right. Here's
my non-right solution to #1:

G places the amulet in his own safe, locks it with the padlock, and keeps the
key. G sends the safe to K by way of a servant. K takes the safe with him and
uses whatever tools to open it at his convenience once he is safe away.

I think this is wrong, because it's not very satisfying at all. I think it
could be right, because (1) it could work in real life and (2) it meets the
solution criteria of the puzzle, namely, transferring the amulet from G to K.

I would be happy to know of a more elegant solution.

~~~
eplawless
That was the first solution I had for #1. I'm currently at the following, but
I think there has to be a better one because it's not clear that it would be
possible.

G places the amulet in his safe, attaches his padlock and locks it with his
key, then sends it to K, keeping his key. K receives G's safe, attaches his
own padlock in addition to G's (there is a "large clasp", no mention of how
large or how many padlocks it could support) and sends it back to G without
sending his key. G removes his own padlock, and sends the chest back. K
removes his padlock and has the amulet.

~~~
midnightmonster
I think your current solution is clearly the right one: It gives me the 'duh'
moment.

Edit: But in real life the first solution might work better. Hard to imagine
the henchmen who would be sure to spot you if you left your room even for a
moment but would take no notice of servants shuffling back and forth three
times with a [double-]padlocked safe.

~~~
riffraff
reason it is unsatisfactiry (I had the same) is that one of the safe is not
used, imo

~~~
RiderOfGiraffes
It's a charasteristic of the real world that there are things not used in the
solutions of the various problems that need to be solved.

It is one of the most brain-dead characteristics of school and university
exams that one is not allowed to have extras - it's somehow "not fair."

I think not using some of the resources provided is perfectly reasonable.

~~~
riffraff
apple and oranges, if the beauty of the problem is in a clean elegant solution
that does not require all of the pieces, it is not a well posed riddle, or
solution.

That's why the solution to the wolf-sheep-cabbage problem is not "just add
more floating stuff so you can bring all at once, idiot".

The comparison to school and exams, appears unrelated to me: there are
situations where external aid kills the point (e.g. calculator for arithemitic
in firs grade).

~~~
RiderOfGiraffes
Then I must not have explained myself clearly enough. I'm not talking about
extra equipment, I'm talking about information that's not needed for the
solution to the problem.

Recently (for some definition of "recent") I was setting an exam question. In
it I gave various lengths, heights, and so on, and I was told that it was too
hard because I gave details that weren't required. On the other hand, if one
is given only the information required, there is already an artificial clue -
all the information given must be used. That's unrealistic.

I've interviewed people for jobs who performed fantastically well on exam
style questions, but when given free-form problems simply didn't know where to
start.

For me, whether a solution is clean and elegant is independent of whether
you've used all the information given. It's the solution itself that's
elegant. It's not only plausible but likely that we have different concepts of
elegance - I'm a mathematician. When solving math problems, real math problems
such as required to get a PhD or publish a paper, there's no way you're given
just the information required and no more.

Along those lines I've been moved to submit another puzzle - you can find it
here:

<http://news.ycombinator.com/item?id=1014092>

------
RevRal
Spoiler: The solution is very easy for problem # two if you're allowed to flip
the coins.

I haven't worked it out since I've been up all night and had to squint just to
read the problem, so I may have read it wrong. I didn't read the first
question.

Have fun.

\----

Edit: Just great, seeing this right when I'm about go to sleep after a long
night. And it appears what I had in mind doesn't work.

~~~
isleyaardvark
No, no. You were on the right track. Think about it with a smaller number of
coins, say 4 coins and you know only 1 is Queen side up.

On the first one: I get the feeling this isn't what the puzzle was looking
for, but I'd just lock the amulet up in the safe, send it to the other spy,
and let them spirit it out of the country. What, does my country not have bolt
cutters?

Edit: Spoiler hint for the first one: Start by sending over an empty safe with
the padlock locked on only one handle of the safe.

------
RiderOfGiraffes
I'm puzzled over the difficulty people are having with number 1. Surely it's
pretty obvious given public-key cryptography ...

~~~
RevRal
I thought it was obvious because I have never come across a person who hasn't
dealt with the logic problem where the farmer has to get a few of his animals
across a river, one at a time, and must do so in a sequence where no animals
will kill each other. There was some vicious animal included.

I immediately recognized that problem #1 is very very same problem, but worded
differently.

But it sounds like you and I have different solutions...?

Edit: Oh okay, I had to look up public-key cryptography. I thought you meant
slip each other secret messages or something.

------
RiderOfGiraffes
I know that many, perhaps most, of you hate logic puzzles, especially as
selection or hiring criteria. And that's fine.

However, the second puzzle on this page is, I think, particularly nice. Feel
free to ignore it.

------
riffraff
I disagree with the premise: there are a lot of elegant logic puzzles
(consider: to mock a mockingbird), it's just that a lot of puzzles dod not
fall in this category :)

------
RiderOfGiraffes
Downmod this if you don't want me to get the karma from up-voting the spoiler
warning.

------
dalke
What kind of hotel room has moveable safes? The ones in the rooms I've been in
are fastened down. What kind of thief would steal anything except for a
portable safe? Couldn't you kidnap one of the thieves, steal the clothes, and
disguise yourself? How would exchanging safes in the middle of the night not
be noticed? Couldn't the henchmen just open up every room looking for them?

Don't safes have built-in locks? My dictionary says a safe is "a strong
fireproof cabinet with a complex lock, used for the storage of valuables."
That definition does exclude some categories of safe, but "strongbox" or
"lockbox" might be a better word.

Having now seen the answer here, I didn't even think that the clasp (shouldn't
that be "hasp"?) might be big enough to admit two locks. That seems like a
poorly designed safe, since that means the door probably opens enough to admit
a crowbar.

Yes, I knew when I started that the answer was "public key cryptography." I'm
just complaining that the puzzle wasn't well stated. Besides, if we're going
along those lines, what if the henchmen start sending safes into every room to
see if it comes back with an extra lock on it? That gives them idea of where
the bad guys/spies might be, and prevents the spies from being able to make
the exchange.

~~~
jcl
Presumably the choice of the word "safe" (and perhaps "clasp") was to make the
solution hard to search for. Traditionally, the word "chest" is used.

[http://www.google.com/webhp?hl=en#hl=en&q=chest+lock+key...](http://www.google.com/webhp?hl=en#hl=en&q=chest+lock+key+puzzle)

~~~
dalke
Ah! I am enlightened. Thanks!

