Use the provided blackjack.py file as a starting point. Use the provided CardDeck class and card images as we discussed in class. The program must open a GraphWin window, deal two cards for the player and one card for the dealer. Display the player cards in a row across the top and the dealer cards in a row underneath the player cards. Display the values of the blackjack hand for the player and the dealer underneath their row of cards. Update the totals of the hands each time a card is dealt. Draw a rectangle with the words “hit me” inside the rectangle on the right side of the screen. Each time you click inside the rectangle, it should deal another card to the player and update their score on the screen. If you click outside the rectangle or go over 21, the program must stop dealing cards to the player. If the player goes over 21, the program must indicate the player “busted”. If the player busts, the dealer does not get any more cards. If the player did not go over 21, the dealer must keep getting cards (display the cards and update the dealer’s score in the window) until the dealer has at least 17. Once the dealer is done getting cards, the program must indicate who won (the total closer to 21 without going over 21) on the screen below the dealer’s score. The program must then wait for a final mouse click before closing the window. The second page of the assignment contains a picture of the window after the game is over.
Unzip the cardset.zip file so you have a cardset directory in the same directory as your Python source files. Test that the demo blackjack.py file displays one card when you run it. If you have problems getting the cardset directory in the correct location, please stop by with your laptop or flash drive in the next day or two.
For 5 bonus points, have aces to count for 1 point whenever counting them as 11 would put the total over 21.
Once you have completed and tested your program, submit it by sending the blackjack.py and help.txt files as an attachment to [email protected] with the subject CS160-1ATT for the 1PM class or CS160-2ATT for the 2PM class.