Talk:100 prisoners: Difference between revisions
(→big speed up: added a comment about reading comments vs. program statements.) |
|||
Line 19: | Line 19: | ||
:: I can't read '''Python''', but I read '''zkl''' comments very well. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 06:15, 7 November 2019 (UTC) |
:: I can't read '''Python''', but I read '''zkl''' comments very well. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 06:15, 7 November 2019 (UTC) |
||
:Well, it's in the statement of the problem (on Wikipedia at least): ''"If just one prisoner does not find his number, all prisoners die."'' So one just has to think of reading the problem statement. [[User:Eoraptor|Eoraptor]] ([[User talk:Eoraptor|talk]]) 12:29, 7 November 2019 (UTC) |
|||
== Test at 10 prisoners too? == |
== Test at 10 prisoners too? == |
Revision as of 12:29, 7 November 2019
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)
- 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)
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 at least): "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)