Hit draws 1 card from the shoe and adds it to the hand. Print_hand prints out the contents of a hand of blackjack. Winnings calculates the amount in winnings of the player based on the player and dealer's cards. Hand_value calculates the value of a player's hand of cards.ĭealer_hand creates a new hand of cards for the dealer by drawing m cards from the deck.ĭealer_hand_value calculates the value of a dealer's hand of cards. New_hand which creates a new hand of cards by drawing m cards from the deck and placing a bet. Shoe which draws m number of cards from the shuffled decks. Shuffle_deck which shuffles n number of decks. The game is set up so that it uses 2 decks of cards. When the play_hand() function is run, SAS will print the dealer's initial face up card, the player's initial hand, the player's next 'action', and finally the results of the game which include the player and dealer's hand values along with the player's amount in winnings based on the bet made. The game is based on one player and the dealer and uses the 'optimal strategy' in order to maximize the player's winnings. This package simulates a blackjack game using multiple functions and modules.Įach function in the package is an instrumental part in running the game, and the play_hand() function is the final module that incorporates all functions to actually simualte the game.