22 Jul '03 22:38>
Originally posted by ddebenedThe two flips are necessary because I have no way of knowing the original position of the left switch, whether it starts up or down. If, on my first visit, I find the left switch in the up position, then it is either the case that the switch started out like that, or that a prisoner been to the room. Thus, it is possible that if everyone flips the left switch only once my count will only proceed to 18, even long after everyone has visited (or, alternatively, it's possible that if I assume on my first visit that the switch in the up position indicates the prior visit of a prisoner, I'll stop counting at 19 with only 18 prisoners having actually visited).
Excellent solution. I am not sure I agree that two visits are required. Would it not work equally well if each person flips the left switch on their first visit and only on their first visit (which would vastly reduce the number of visits required to conclude that all persons had visited the room)?