The python code for interruption() doesn’t quite make sense to me.
for day in days:
if interrupt_chance > random.random():
return day, coin
Suppose that day is Tuesday here. Then the function returns Tuesday, Tails, which represents that on a Tails Tuesday Beauty wakes up and is rescued by Prince Charming. But in this scenario she also woke up on Monday and was not rescued. This day still happened and somehow it needs to be recorded in the overall stats for the answer to be accurate.
This particular outcome is extremely rare: less then a tenth of a percent. It doesn’t contribute much to the results:
interrupted_coin_guess = []
not_interrupted_coin_guess = []
for i in range(100000):
day, coin = interruption()
if day is not None:
interrupted_coin_guess.append(coin == 'Heads')
if day == 'Tuesday':
not_interrupted_coin_guess.append(coin == 'Heads')
else:
not_interrupted_coin_guess.append(coin == 'Heads')
print(interrupted_coin_guess.count(True)/len(interrupted_coin_guess))
# 0.363013698630137
print(not_interrupted_coin_guess.count(True)/len(not_interrupted_coin_guess))
# 0.501831795159256
The point is that specifically in the rare outcomes where the Beauty is interrupted (some low probable random event happens and beauty notices it) she can guess Tails with 2⁄3 accuracy (actually a bit worse than that, the rarer the event the closer it is to 2⁄3) per experiment. Which she can not do when she is not interrupted.
Sure, it’s rare with the given constants, but we should also be able to run the game with interrupt_chance = 0.1, 0.5, 0.99, or 1.0, and the code should output a valid answer.
Naively, if an interruption increases the probability of the coin being Tails, then not being interrupted should increase the probability of the coin being Heads. But with the current python code, I don’t see that effect, trying with interrupt_chance of 0.1, 0.5, or 0.9.
Sure, it’s rare with the given constants, but we should also be able to run the game with interrupt_chance = 0.1, 0.5, 0.99, or 1.0, and the code should output a valid answer.
Well, if you want to use custom chance then you shouldn’t actually count not interrupted Monday if the Tuesday was interrupted. You see, here we count beauty being interrupted per experiment. If we count not interrupted Monday as a separate experiment we mess our metrics up, which isn’t a big deal with very low chance of interruption but becomes relevant with custom chances.
Naively, if an interruption increases the probability of the coin being Tails, then not being interrupted should increase the probability of the coin being Heads.
If you do not count non-interrupted Monday, when Tuesday is interrupted that’s indeed what happens and is clearly visible on high interruption chances. After all, if there is a highly probable event that can happen at every awakening it’s much more likely not to happen if you are awaken only once. The probability of Heads on not being interrupted increases from 0.5 and approaches 1 with the interruption chance increase. This would be extremely helpful, sadly this information is unavailable. Beauty can’t be shure what high likely event didn’t happen in the experiment due to the memory loss—only what event didn’t happen in this awakening.
This code-based approach is a very concrete approach to the problem, by the way, so thank you.
if you want to use custom chance then you shouldn’t actually count not interrupted Monday if the Tuesday was interrupted.
Sure. So let’s go back to the first way you had of calculating this:
for n in range(100000):
day, coin = interruption()
if day is not None:
interrupted_coin_guess.append(coin == 'Heads')
else:
not_interrupted_coin_guess.append(coin == 'Heads')
print(interrupted_coin_guess.count(True)/len(interrupted_coin_guess))
# 0.3006993006993007
The probability this is calculating is a per-experiment probability that the experiment will be interrupted. But Beauty doesn’t ever get the information “this experiment will be interrupted”. Instead, she experiences, or doesn’t experience, the interruption. It’s possible for her to not experience an interruption, even though she will later be interrupted, the following day. So this doesn’t seem like a helpful calculation from Beauty’s perspective, when Prince Charming busts in through the window.
The beauty gets the information “This experiment is interrupted” when she observed the interruption on her awakening. She never gets the information “This experiment is not to be interrupted” because the interruption could happen on the other awakening.
This means that specifically in the awakening that the experiment is interrupted/some random low probable event happens, the Beauty can determine how the coin landed in this particular experiment better than chance, contrary to other awakenings.
The python code for
interruption()
doesn’t quite make sense to me.Suppose that day is Tuesday here. Then the function returns Tuesday, Tails, which represents that on a Tails Tuesday Beauty wakes up and is rescued by Prince Charming. But in this scenario she also woke up on Monday and was not rescued. This day still happened and somehow it needs to be recorded in the overall stats for the answer to be accurate.
This particular outcome is extremely rare: less then a tenth of a percent. It doesn’t contribute much to the results:
The point is that specifically in the rare outcomes where the Beauty is interrupted (some low probable random event happens and beauty notices it) she can guess Tails with 2⁄3 accuracy (actually a bit worse than that, the rarer the event the closer it is to 2⁄3) per experiment. Which she can not do when she is not interrupted.
Sure, it’s rare with the given constants, but we should also be able to run the game with interrupt_chance = 0.1, 0.5, 0.99, or 1.0, and the code should output a valid answer.
Naively, if an interruption increases the probability of the coin being Tails, then not being interrupted should increase the probability of the coin being Heads. But with the current python code, I don’t see that effect, trying with interrupt_chance of 0.1, 0.5, or 0.9.
Well, if you want to use custom chance then you shouldn’t actually count not interrupted Monday if the Tuesday was interrupted. You see, here we count beauty being interrupted per experiment. If we count not interrupted Monday as a separate experiment we mess our metrics up, which isn’t a big deal with very low chance of interruption but becomes relevant with custom chances.
If you do not count non-interrupted Monday, when Tuesday is interrupted that’s indeed what happens and is clearly visible on high interruption chances. After all, if there is a highly probable event that can happen at every awakening it’s much more likely not to happen if you are awaken only once. The probability of Heads on not being interrupted increases from 0.5 and approaches 1 with the interruption chance increase. This would be extremely helpful, sadly this information is unavailable. Beauty can’t be shure what high likely event didn’t happen in the experiment due to the memory loss—only what event didn’t happen in this awakening.
This code-based approach is a very concrete approach to the problem, by the way, so thank you.
Sure. So let’s go back to the first way you had of calculating this:
The probability this is calculating is a per-experiment probability that the experiment will be interrupted. But Beauty doesn’t ever get the information “this experiment will be interrupted”. Instead, she experiences, or doesn’t experience, the interruption. It’s possible for her to not experience an interruption, even though she will later be interrupted, the following day. So this doesn’t seem like a helpful calculation from Beauty’s perspective, when Prince Charming busts in through the window.
The beauty gets the information “This experiment is interrupted” when she observed the interruption on her awakening. She never gets the information “This experiment is not to be interrupted” because the interruption could happen on the other awakening.
This means that specifically in the awakening that the experiment is interrupted/some random low probable event happens, the Beauty can determine how the coin landed in this particular experiment better than chance, contrary to other awakenings.