Probabilidad de tener 4 dobles al pelo
Escenario
¿Probabilidad de tener 4 dobles al pelo? (sí, sí, estadísticamente posible pero muy improbable)
Resultado
Por segunda vez en este blog se decidió correr esta simulación 16800 veces.
De 16800 veces sola 1 trajo cumplió con este escenario (0,005%)
¿Te ha pasado esto?
Aquí te dejo el código en python:
player_one_four_doubles_al_pelo_count = 0
# Iterate through each simulation
for simulation_hands in all_simulations_player_hands:
p1_hand = simulation_hands[0] # Player One's hand
doubles_in_hand = []
for piece in p1_hand:
if piece[0] == piece[1]:
doubles_in_hand.append(piece[0]) # Store the value of the double
# Check if Player One has exactly four doubles
if len(doubles_in_hand) == 4:
all_four_doubles_al_pelo = True
for double_value in doubles_in_hand:
# A double (X,X) is 'al pelo' if the number X appears exactly twice in the hand (only the double piece itself).
if count_number_in_hand(p1_hand, double_value) != 2:
all_four_doubles_al_pelo = False
break # No need to check further if one is not 'al pelo'
if all_four_doubles_al_pelo:
player_one_four_doubles_al_pelo_count += 1
print(f"\nNúmero total de veces que el Jugador Uno tuvo exactamente cuatro dobles y los cuatro estaban 'al pelo' (en {num_simulations} simulaciones): {player_one_four_doubles_al_pelo_count}")
Comments
Post a Comment