This is a discussion on Riddle Thread within the A Brief History of Cprogramming.com forums, part of the Community Boards category; In my circle of friends, this one is well-known by now, but maybe you haven't heard of it already: You ...

1. ## Riddle #3: three dwarfs, two paths, one life

In my circle of friends, this one is well-known by now, but maybe you haven't heard of it already:

You walk along a path until you reach a crotch. One way leads to your destination, the other to sudden death, but you don't know which one is right. Fortunately, there is a house with three dwarfs. One always tells the truth (A), one always lies (B), and one sometimes tells the truth and sometimes lies (C).

How do you find out the right path with only two questions?

Greets,
Philip

2. ## Riddle #3: three dwarfs, two paths, one life

I only knew this one without C and only one question. But it's still fairly similar .

3. ## Riddle #2: one night in the UAE

My question is why was this on a "systems architecture" exam...it seems quite tangential to the material that should be taught in a systems architecture class.

4. ## Riddle #3: three dwarfs, two paths, one life

Actually, I thought about it... I was used to saying, as answer "Which direction would the other say I'd have to go". But I think this one is possible with one question:
- Which way would the one of you that always speaks the truth say you would say I'd have to go?

The one who always speaks the truth would speak the truth about the way and point the proper direction.
The one who always lies knows the one who would speak the truth would tell he'd say the wrong direction. But he lies about that fact, so he points to the proper direction.
The one who sometimes speaks the truth is undecided.

So two always point to the proper way.

5. ## Riddle #3: three dwarfs, two paths, one life

I'd just choose which direction to take myself, and then hope I took the right one, that way I don't have to go through the hassle with the dwarves

6. ## Riddle #2: one night in the UAE

Originally Posted by DavidP
My question is why was this on a "systems architecture" exam...it seems quite tangential to the material that should be taught in a systems architecture class.
Because back then, our prof told us all questions from the exam in advance, except this one. He didn't want to give 100% of the points to someone who merely learned everything by heart.

BTW, the number of people that managed to pass the exam was below 50%. My prof's theory was that everyone who learns the stuff will pass anyway, and everyone else won't learn enough even if they know exactly what to learn. He was proven right: the overall result was comparable to his other exams.

Greets,
Philip

7. ## Number theory in 21 minutes

Damn... My argument to why I don't understand any of this is... I haven't finished school xP Now make the algorithm for randomness for me >: D

8. ## Number theory in 21 minutes

Well that makes for an interesting optimization for large prime number searches. I wonder what percentage of workload it would reduce to first check that a number met that particular criteria.

9. ## Riddle #3: three dwarfs, two paths, one life

Originally Posted by EVOEx
Which way would the one of you that always speaks the truth say you would say I'd have to go?

The one who always speaks the truth would speak the truth about the way and point the proper direction.
The one who always lies knows the one who would speak the truth would tell he'd say the wrong direction. But he lies about that fact, so he points to the proper direction.
The one who sometimes speaks the truth is undecided.

So two always point to the proper way.
Right. Now you have one question left to determine who's (C), or who's not.

This is the interesting part. Without (C), my grandma would solve this riddle in no time :P

Greets,
Philip

10. ## Riddle #3: three dwarfs, two paths, one life

I guess that would work...

I would have just used sequential Bayes

(I.E. ask two dwarfs which is the right path and use sequential Bayes to calculate the probability of each being the actual correct one)

11. ## Riddle #3: three dwarfs, two paths, one life

Why? Only one person will answer? :P I thought just ask all three of them at the same time. It's really just one question... And if all three of them answer, you're done.

12. ## Number theory in 21 minutes

Originally Posted by abachler
Well that makes for an interesting optimization for large prime number searches. I wonder what percentage of workload it would reduce to first check that a number met that particular criteria.
A number is dividable by 2 and 3 if it is dividable by 24, so checking if 2 or 3 divides a given number is probably much faster (and tells you more about the number).

Greets,
Philip

13. ## Riddle #3: three dwarfs, two paths, one life

Originally Posted by EVOEx
Why? Only one person will answer? :P I thought just ask all three of them at the same time. It's really just one question... And if all three of them answer, you're done.
I guess there's only one dwarf supposed to answer. But if all three were allowed to answer, what would you ask?

Greets,
Philip

14. ## Riddle #3: three dwarfs, two paths, one life

Like I said before:
Which way would the one of you that always speaks the truth say you would say I'd have to go?

The one who always speaks the truth would speak the truth about the way and point the proper direction.
The one who always lies knows the one who would speak the truth would tell he'd say the wrong direction. But he lies about that fact, so he points to the proper direction.
The one who sometimes speaks the truth is undecided.

So two always point to the proper way.

If all three answer, two point you to the right way, and the other you don't know... And the riddle doesn't say only one dwarf will answer your question :P.

15. ## Riddle #3: three dwarfs, two paths, one life

Well, now you can imagine why nobody will let me do mental arithmetic...

I hereby establish that only one dwarf is allowed to answer per question.

Greets from Graz,
Philip

Page 2 of 8 First 12345678 Last