tag:blogger.com,1999:blog-7167710173717429664.post6654719800267385175..comments2017-06-15T08:53:37.844-07:00Comments on ToughNut: 29 hostages and a terroristFreddohttp://www.blogger.com/profile/06503181718327745286noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7167710173717429664.post-84539379618222888532011-03-23T07:13:50.281-07:002011-03-23T07:13:50.281-07:00Hado has it.
Designate one person as the counter....Hado has it.<br /><br />Designate one person as the counter. Designate one switch (A) as a junk switch, and one switch (B) as the count switch.<br /><br />Because the initial state is unknown and because no hostage knows if he or she is the first person, everybody has to be counted twice.<br /><br />The first time the counter enters the room, B is flipped down if it is up. This sets the initial state. If it is down, A is flipped. When anyone else enters the room, B is flipped up if B is down and if he or she has not flipped B twice. Otherwise, A is flipped.<br /><br /><br />Here are the algorithms for the counter and every one else.<br /><br /># Every one (not the counter) #<br />if (! counted twice)<br />__if (!B)<br />____flip (B)<br />__else<br />____flip (A)<br />else<br />__flip (A)<br /><br /># Designated counter #<br />if (isFirst) // First time entering the room<br />__if (B)<br />____flip (B) // Set initial state<br />__else<br />____flip (A) // Initial state already set<br />else<br />__if (B)<br />____increment count<br />____if (count >= 2 * 28)<br />______call it // Everybody counted twice!<br />____else<br />______flip (B) // Reset count switch<br />__else<br />____flip (A)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7167710173717429664.post-57991553173403236572010-11-21T11:52:11.269-08:002010-11-21T11:52:11.269-08:00A friend told me a similar riddle a few days ago a...A friend told me a similar riddle a few days ago and it took me forever to figure out.<br />However, in that example you KNEW the beginning state. This is a bit tricky.<br /><br />In that case, I designated one hostage to be the "guy who calls it."<br />Then, each person flips the right switch if they go once. Then the left switch all the times after that. But they only flip the right switch if it's down. If it's up, they flip the left one. That way, each one time the right switch is flipped serves as a "count" that one guy has been there.<br />Then, when the "guy who calls it" comes, he flips right down, indicating he "counted" it. Then the next guy, if they haven't been counted, flips right.<br />The "guy who calls it" will have to go 28 times.<br /><br />Now, I'm just thinking how to do it in this case... <br />Oh, maybe you could just make everyone go twice. So, they need to indicate to the main guy TWO times. So, if the right switch begins in the ON position, the guy will mistakenly count it as a person. But that is OK. Just make everyone go twice. Then when the main guy counts to 59. Then he calls it.<br />The idea of the response above me is on the right track, but the problem in a repeating sequence is that if you see the same state, you don't know if 4, or 8, or 12 people have gone in between.<br />Sweet.hadonoreply@blogger.comtag:blogger.com,1999:blog-7167710173717429664.post-56685886550193579942010-10-18T01:18:11.772-07:002010-10-18T01:18:11.772-07:00this is what i think the answer cud be..
now every...this is what i think the answer cud be..<br />now every hostage when first time goes to the cell, will notice the current position, and that will be like the reference position for each of them.now everyone will decide a sequence before hand..as in<br />11->10->00->01->11..the order in which the switches need to be changed.<br /><br />now each time a hostage goes in he will follow the sequence and make the changes to the switch system and the next time he goes in,he will undo what he did the last time..<br />now if that person observes any change in the switch system,he will come to know how many more hostages have been to the room!(except him)<br />and if the system is the same, this might happen because either he has been chosen again or the cycle has been completed,but since the hostages have to be sure,he will take it as he has been chosen again only..<br />now since all the hostages will be keeping the track and counting,so the moment any hostage counts 28 he may declare that all of them has been to the place..<br /><br />also since we cant determine the number of times the hostages be taken to the room and only the strategy has to be defined,.this might take some time but this is what i feel the strategy should be!karannoreply@blogger.comtag:blogger.com,1999:blog-7167710173717429664.post-52030477193915145172010-10-13T11:31:54.091-07:002010-10-13T11:31:54.091-07:00i did not get a few things!
1st- " I may choo...i did not get a few things!<br />1st- " I may choose the same guy three times in a row, or I may jump around and come back" <br />what does this mean..<br /><br />2nd- how will the terroist come to know whether the hostages are telling the truth about them being to the room atleast once..<br />will the terrorist be keeping track of who has been to the room..?Anonymousnoreply@blogger.com