100 Prisoners, 100 lines of code
r-bloggers.com
r-bloggers.com
I'm pretty sure that since this is less random than the original version the survival rate would go up, but I haven't figured out how to do this.
Now, if you randomly picked a permutation P, then by symmetry since you don't know anything about the placement of numbers, you'd do just as well as with the original strategy. On the other hand, what you've proposed is that the warden has told you that choosing P to be identity results in failure. So if you exclude identity and pick one of the other permutations for your strategy, you'll fare a little tiny bit better on average.
You can do even better than this by picking from a more specialized class of permutations for P. I'll leave the problem of finding the best class for P as a follow up.
Were I a particularly evil warden, I could meticulously place all the boxes in the same such "jumble" after each prisoner left. One of the prisoners would certainly derive a different ordering of the boxes than one of the other prisoners. The approach might still have a better than random chance of succeeding, but it would be lower than that outlined in the article, since there are now two (or more) chances for a cycle of length greater than 50.
That's nothing. I'd make all of the boxes too small to even see, and I'd turn out the lights. Oh, and I'd shoot all of the prisoners.
If I understood correctly, the idea is to have a consistent strategy for all prisoners, which "clumps" the winning results from 51 to 100 into 100.
As an alternative: Try to make the successes of the prisoners _not_ statistically independent.
with 4 prisoners the probability of success is about 0.37, which is better than chance. (the probability of success turns out to be one minus the difference of two harmonic numbers.)
it's hard to give a hint without giving the answer. the best i can do is that it has to do with the structure of cycles in permutations.
Semi-Spoiler alert
As I interepreted the parent post, he hasn't found a way, with 2 prisoners, to do better than the strategy of every prisoner picking a random box. Under that strategy, your chance of success is 0.25 - 0.5 * 0.5 (each has a 0.5 chance of being right).
So if, as you say, you can get the probability to 0.5 for 2 prisoners, you are doing better than chance. (And this I already know how to do, I'm assuming for more prisoners it's the same idea, but generalized).
Am I making sense at all?
HINT: Suppose each prisoner picks a box at random. They can (randomly) decide what box to open before they enter the room with the boxes, at a time when they can still communicate. In some cases they will then be able to determine that they have no chance of both finding their number. So there must be a better strategy.