Talk:100 prisoners

From Rosetta Code
Revision as of 12:57, 7 November 2019 by Hout (talk | contribs) (Only numbers not yet visited at still need to be checked.)

Wikipedia link?

Despite the heading on the task page claiming otherwise, there does not appear to be a wikipedia entry for "100 prisoners" --Thundergnat (talk) 00:56, 5 November 2019 (UTC)

Fixed.     -- Gerard Schildberger (talk) 19:04, 5 November 2019 (UTC)
Thanks. (Although I'm in two minds - maybe wikipedia should just be another reference)? --Paddy3118 (talk) 20:40, 5 November 2019 (UTC)
Well, if that's where you obtained the description, then leave it as is;   but Wiki's description is more more dire   (with a penalty of execution for all if any prisoner fails).   Brutal.     Not   G   rated.     -- Gerard Schildberger (talk) 20:55, 5 November 2019 (UTC)
I copied this part too, as otherwise the problem is not clearly stated: what if any fails? It wasn't even mentioned. Eoraptor (talk) 12:34, 7 November 2019 (UTC)

big speed up

Thanks to (userid)   Craigd   (using zkl),   his observation/optimization of:       if one prisoner fails, they all do.

A big decrease in time used.


It's programmers like Craigd that make me say:       Damn!     Why didn't   I   think of that ?!?!     -- Gerard Schildberger (talk) 20:28, 5 November 2019 (UTC)

That's in the Python too; the first failing prisoner breaks out of the for prisoner in ... loop. --Paddy3118 (talk) 20:48, 5 November 2019 (UTC)
I can't read   Python,   but I read   zkl   comments very well.     -- Gerard Schildberger (talk) 06:15, 7 November 2019 (UTC)
Well, it's in the statement of the problem (on Wikipedia, now also on RC): "If just one prisoner does not find his number, all prisoners die." So one just has to think of reading the problem statement. Eoraptor (talk) 12:29, 7 November 2019 (UTC)

Test at 10 prisoners too?

Would it be worth asking for a test run at 10 prisoners as well (as I did in the Perl 6 entry) to verify that the logic is correct for random selection? Right now, with 100 prisoners the random portion could be just be: "Fail" and it would be only be wrong 7.89e-29 percent of the time. If tested with 10, the prisoners should be pardoned ~.097 percent of the time. Though I see that the task has already been promoted out of draft after... ~18 whole hours? What's the rush? --Thundergnat (talk) 22:45, 5 November 2019 (UTC)

No card viewed en route to a find needs further checking

If a prisoner finds their card within the number of steps allowed, all card numbers viewed en route can also be found in exactly the same number of steps.

Only numbers not yet seen still need to be checked. Hout (talk) 12:56, 7 November 2019 (UTC)