Your analogy with dice tells me you still don't understand prefix searching. No, that's not what I'm saying. If you focused on understanding more and hating less, you would easily understand what the probabilistic prefix search method is based on. The fact that a six appears on the fifth roll doesn't mean that another 6 is less likely on the sixth; they are independent events. But it is true that if they tell you to roll a die 6 times, and the second time you got a 6, it's normal for you to bet that there won't be another 6 in the next 4 events. Although it could happen, statistically it doesn't change the probability of 1/6.
And just to show for the millionth time that you have no clue on how to actually compute probabilities, I gave you some benefit of the doubt and implemented your bet idea.
The math is already against you on it, because there is a 51.8% chance that, if you get a 6 on the second roll, you will get another 6 during the next 4 rolls. So it's a losing bet, according to the probabilistic computation that you so much fail to compute. But let's screw the math, and implement the game!
import os
def roll():
return 1 + int.from_bytes(os.urandom(4)) % 6
funds = 1000
num_bets = 0
num_wins = 0
num_loses = 0
while funds > 0:
# roll the first dice
value = roll()
if value == 6:
# don't bet if we got 6 in the first roll
continue
# second roll
value = roll()
if value == 6:
# play the bet
num_bets += 1
investment = 1
won = True
# if we have another 6 in the next 4 rolls, we lose
for _ in range(4):
if roll() == 6:
won = False
break
if won:
funds += investment
num_wins += 1
else:
funds -= investment
num_loses += 1
print(
f'Funds after {num_bets} bets: {funds}'
f' wins: {num_wins} ({num_wins/num_bets:%})'
f' loses: {num_loses} ({num_loses/num_bets:%})'
)
And let's now play it!
...
Funds after 27053 bets: 3 wins: 13028 (48.157321%) loses: 14025 (51.842679%)
Funds after 27054 bets: 2 wins: 13028 (48.155541%) loses: 14026 (51.844459%)
Funds after 27055 bets: 1 wins: 13028 (48.153761%) loses: 14027 (51.846239%)
Funds after 27056 bets: 0 wins: 13028 (48.151981%) loses: 14028 (51.848019%)
OUCH WE WENT BROKE. And we only won 48.15% percent of the time.
For more financial advices follow mcdouglasx. Don't forget to like and subscribe for notifications.