aspose file tools*
The moose likes Programming Diversions and the fly likes The next day - take 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "The next day - take 2" Watch "The next day - take 2" New topic
Author

The next day - take 2

Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
Here's a variation:
In the execution chamber there are two switches, one that works and one that doesn't. The prisoner gets to choose which switch is thrown. If the non-functioning switch is thrown the prisoner is set free.
And, the prisoner gets to ask the executioner (who knows which switch works), one question before making his choice.
One catch, the executioner either ALWAYS tells the truth, or he ALWAYS lies.
What question can the prisoner ask to determine which switch is which?


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

If I were to ask you whether this switch would kill me, would you say "No?"

Basically, if the executioner always tells the truth, then you have nothing to worry about. If he always lies, then you have to get him to lie about his fibbing. Since we're dealing with boolean logic (Yes/No), that amounts to telling the truth.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

[HIJACK]
Since these types of questions are usually set on remote southern Pacific islands with tribes of natives, here's another variation (my favourite) set in that location:
------------------------
You are on the Island of Minjuro, a small, desolate, one-acre patch of land in the middle of the South Pacific ocean (165 degrees W, 5 degrees S, if you're interested). Despite its size, there are no fewer than four tribes of people on the island: The Minjari, who always tell the truth; the Juromin, who always lie; the Nimoruj, who will sometimes tell the truth and sometimes lie and will only answer one question a day, and the Urojimn, who are cannibals who will eat anybody who asks them a question longer than twelve words, otherwise they always tell the truth. Members of all four tribes are indistuingishable to outsiders. You come to the island to visit the fabled hundred-foot Tower of Minjuro, the island's most famous tourist attraction. Unfortunately, you do not have a map. You come to a crossroads on the island, and there are three indiginants standing at the crossroads. How do you get to the tower before the sun sets by asking at most three questions?
[/HIJACK]
[ July 06, 2003: Message edited by: Joel McNary ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Something like the first puzzle has appeared in MD several times in the past - but it's refreshing to finally see someone post it without the unnecessary baggage of a second guard.
The only loophole I see it is that the guard here isn't necessarily constrained to answer the question directly at all.
Q: "If I were to ask you whether this switch would kill me, would you say 'No?'"
A1: "I'm not going to answer that." (true)
A2: "Doesn't matter - actually neither switch will kill you." (false)


"I'm not back." - Bill Harding, Twister
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Joel's problem:
the Urojimn, who are cannibals who will eat anybody who asks them a question longer than twelve words
I haven't heard of these guys before. Cool.
For each of the 3 possible directions (assuming the crossroads has 2 roads with 4 possible ways to go, and you came from one of them) point down the road and ask one of the islanders, "Sir, would you say this road leads to the Tower of Minjuro?" (Extra "sir" provided because it can't hurt to be polite - of course, replace with "madam" if appropriate, or she might get and decide 12 words is too much in this case.)
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

Good, although I should have constrained the problem to only two questions...
My solution is:
Ignore the islanders and walk straight to the tower. Hundred-foot towers are not difficult to spot on one-acre desolate patches of land.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Hundred-foot towers are not difficult to spot on one-acre desolate patches of land.

OK, but my solution works at night too. And it's true that we don't really need the third question, or the third islander. If the first two answers are "no", take the remaining road.
 
 
subject: The next day - take 2