At the beginning, where the hidden passage is explained, isn't there a "race condition", where Ali Baba would eventually (across 40 repetitions) run into the thief? The thief picks one branch, Ali Baba the other. The thief uses the passage, then walks right into Ali Baba?
I don't understand how the thief can be sure to never walk into Ali Baba coming down the other path at some time.
The thief waits in his own passage until he knows the victim has followed him down that passage. He does not pass through the door if the victim is in the other passage. The authors briefly mention this:
> After a very uncomfortable wait he saw a thief arrive who, *sensing he was pursued by his victim*, whispered the magic words, “Open sesame.”
I guess the thief can observe / hear Ali Baba's approach and decide on using the secret passage to go to the other path (if Ali Baba is approaching his way) or just run out the current passage if Ali Baba chose the other one.
https://www.researchgate.net/publication/221355016_How_to_Ex...