This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Easy]Road to capital

 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have taken this problem from 'Discrete Mathematics' by C N Liu.
In one country ,all people always lie or always talk truth.These people always answer in the form of 'Yes/No' ONLY.One tourist is visiting this country and saw the inhibitant sitting near a junction.One road goes to capital of the country and another goes to desert.Tourist wants to go to capital.By asking ONLY ONE question,tourist should find the road which goes to capital.
What question should tourist ask to inhibitant?
[ August 11, 2003: Message edited by: Capablanca Kepler ]
[ August 11, 2003: Message edited by: Capablanca Kepler ]
 
Karthikeyan Rajendraprasad
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the question will be like
"if i ask your friend, "which road leads to the desert ? what will be his answer? "
the traveller should take the other road to go to the capital.
Let us take all are telling the truth if we ask the question, his friend should say the correct road to the desert and he also will say the same road to desert. so now we can take the other road to go to the capital.
if all are telling lies and if we ask the question his friend should say the wrong road(road to the capital) and as he is a liar he wont say the same road and say the road to the desert. so now we can take the other road to go to the capital.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"if i ask your friend, "which road leads to the desert ? what will be his answer? "
First, what friend? The question only mentioned one person by the road.
Second, even if there are two people present (or maybe you can talk about some other friend even though he's not physically there), why assume that either they're both liars, or both truthful? Maybe one's a liar and the other's truthful. Then your answer won't work.
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
"if i ask your friend, "which road leads to the desert ? what will be his answer? "
First, what friend? The question only mentioned one person by the road.
Second, even if there are two people present (or maybe you can talk about some other friend even though he's not physically there), why assume that either they're both liars, or both truthful? Maybe one's a liar and the other's truthful. Then your answer won't work.

Jim,the ALL people are either speak truth or ALL people speak false.People are not divided there.
Karthink was almost right.
Tourist should ask "If I ask any person from your country that does the road to the left goes to capital,Will he answer Yes?"
[ August 12, 2003: Message edited by: Capablanca Kepler ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure about this...
"Would your answer be 'Yes' if I asked is this the way to the Capital"
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If all people(i.e. me too)truth speaking and if the road to the left goes to capital,my answer will be Yes.If all people(i.e. me too) are liars (and road to left goes to capital)then also my answer will be Yes.So if answer is Yes then tourist can conclude that road to left goes to capital.
On the other hand if all people are truth speaking and road to capital goes to right,then my answer will be No.Whereas if all the people are liars and road to right goes to capital,still my answer be No.So tourist can conlude if answer is No,road to right must be going to capital.
[ August 12, 2003: Message edited by: Capablanca Kepler ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,the ALL people are either speak truth or ALL people speak false.People are not divided there.
Really? Well, that's a new version. I couldn't tell that from your initial problem statement. Anyway, I like Michael Dunn's answer, as it works regardless of how other people on the island behave. (Or even if there's no one else on the island.) See also this post, including Joel McNary's version.
[ August 12, 2003: Message edited by: Jim Yingst ]
 
Vivek Kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Jim. The original version suggests that 'any' person on island either always seaks truth or always speak lie. Still, the answer given by karthikeyan is correct.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic