''' DS2000 Spring 2023 Sample code from class - making objects in the driver Section 3 - blackjack * two players * deal two cards to each * they can each hit or stay (just once!) * add up the points in the card, where * Ace is always = 11 * J = Q = K = 10 * Otherwise, blackjack value is value of the card * Note that ace is always high (this coudl be fixed!) * In case of hitting exactly 21, you win no matter what the other player does * In case of going over 21, you lose no matter what * Otherwise, whoever had more points wins * And in case of a tie, no one wins ''' # from [filename] import [classname] from card import Card from deck import Deck def main(): # Initialize players' names and starting $$ p1_name = "Laney" p2_name = "Kayla" # Make the deck! d = Deck() d.shuffle() # Deal two cards to player one p1_c1 = d.deal() p1_c2 = d.deal() p1_sum = p1_c1.blackjack_num + p1_c2.blackjack_num # Tell the player which cards they have print(p1_name, ", you have...", sep = "") print(p1_c1) print(p1_c2) # give the user the option to hit or stay choice = input("Enter h to hit to s to stay\n") if choice == 'h': p1_c3 = d.deal() print("Your third card is...", p1_c3) p1_sum += p1_c3.blackjack_num print("Your total hand:", p1_sum) if p1_sum > 21: print("BUSTED!!!!! :(") elif p1_sum == 21: print("AUTOMATIC WIN!!!!! :):):):)") # Deal two cards to player two p2_c1 = d.deal() p2_c2 = d.deal() p2_sum = p2_c1.blackjack_num + p2_c2.blackjack_num # Tell the player which cards they have print("\n", p2_name, ", you have...", sep = "") print(p2_c1) print(p2_c2) # give the user the option to hit or stay choice = input("Enter h to hit to s to stay\n") if choice == 'h': p2_c3 = d.deal() print("Your third card is...", p2_c3) p2_sum += p2_c3.blackjack_num print("Your total hand:", p2_sum) if p2_sum > 21: print("BUSTED!!!!! :(") elif p2_sum == 21: print("AUTOMATIC WIN!!!!! :):):):)") # who won the hand? if p1_sum > p2_sum and p1_sum < 21: print(p1_name, "wins!") elif p2_sum > p1_sum and p2_sum < 21: print(p2_name, "wins!") elif p1_sum == p2_sum and p1_sum < 21: print("TIE, so nobody won:(:(:(:(") main()