import random
def lying_flippers(num_flips=1_000_000):
"""
- Bob flips a coin and tells Alice the result but lies 20% of the
time.
- Alice tells me Bob's result but also lies 20% of the time.
- If I trust Bob, I know I'll be correct 80% of the time.
- If I trust Alice, how often will I be correct (assuming I don't
know Bob's result)?
"""
# Invert flip 20% of the time.
def maybe_flip_flip(flip: bool):
if random.random() < 0.2:
return not flip
return flip
def sum_correct(actual, altered):
return sum(1 if a == b else 0 for (b, a) in zip(actual, altered))
half_num_flips = num_flips // 2
twenty_percent = int(num_flips * 0.2)
actual_flips = [random.choice((True, False)) for _ in range(num_flips)]
num_heads = sum(actual_flips)
num_tails = num_flips - num_heads
print(f"Heads = {num_heads} Tails = {num_tails}")
bob_flips = [maybe_flip_flip(flip) for flip in actual_flips]
alice_flips = [maybe_flip_flip(flip) for flip in bob_flips]
bob_num_correct = sum_correct(actual_flips, bob_flips)
bob_percent_correct = bob_num_correct / num_flips
alice_num_correct = sum_correct(actual_flips, alice_flips)
alice_percent_correct = alice_num_correct / num_flips
# Trusting Bob should lead to being correct ~80% of the time.
# This is just a verification of the model since we already know the answer.
print(f"Trust Bob -> {bob_percent_correct:.1%}")
# Trusting Alice should lead to being correct ?% of the time.
# This model produces 68%.
print(f"Trust Alice -> {alice_percent_correct:.1%}")
print()
I don't think this is true at all. If anything, it's the opposite, in that MS has greatly improved recent versions of Visual Studio.
> VSCode is the future
Maybe for some types of projects, but I have both VS and VS Code on my work machine and hardly ever use VS Code. There's just no comparison when working on .NET projects where VS is the clear winner.