def main(): player_wins = 0 dealer_wins = 0 draws = 0 plays = 0 new_deck1, new_dealer1, new_hand1, ace_dealer1, ace_hand1 = Start.start() answer = float(input("How many times do you want to run the simulation? ")) print() done = False while not done: if plays == answer: break if new_hand1 == 21: player_wins += 1 plays += 1 continue new_deck2, new_hand2, ace_hand2, new_dealer2, ace_dealer2 = \ Start.bot(new_deck1, new_hand1, ace_hand1, new_dealer1, ace_dealer1) if new_hand2 == 21: player_wins += 1 plays += 1 continue elif new_hand2 > 21: dealer_wins += 1 plays += 1 continue new_deck3, new_hand3, ace_hand3, new_dealer3, ace_dealer3 = \ dealer_turn(new_deck2, new_hand2, ace_hand2, new_dealer2, ace_dealer2) if new_dealer3 == 21: dealer_wins += 1 plays += 1 continue elif new_dealer3 > 21: player_wins += 1 plays += 1 continue elif new_hand1 == new_dealer1: draws += 1 plays += 1 continue elif new_dealer3 > new_hand3: dealer_wins += 1 plays += 1 continue elif new_dealer3 < new_hand3: player_wins += 1 plays += 1 continue print() print("You ran the simulation", plays, "times") print() print("You won", player_wins, "times") print("The dealer won", dealer_wins, "times") print("There were", draws, "draws") print() print(player_wins + dealer_wins + draws) print()
import Start new_deck1, new_dealer1, new_hand1, ace_dealer1, ace_hand1 = Start.start() Start.bot(new_deck1, new_dealer1, new_hand1, ace_dealer1, ace_hand1)