My Blackjack Terminal Game

For my Terminal game project, I decided to make a blackjack game. To start this project I created a class that built a deck of cards as a list and then used that list of cards to create a dictionary that gave each card a value.

After creating the deck of cards class, I made a function for the main part of my game, blackjack. Basically, this function starts by dealing 2 cards to the player and 2 cards to the dealer and calculating the value of the cards in each hand. To deal with the cards I created a separate function. this function used random.choice to choose one of the cards fro my deck of card list saved it to a variable card then appended it to a list for the delt hand. I then added the value of that card to a variable. Finally, I removed the card from the deck list.

After dealing with the 2 hands my function prints the player’s hand and the first card in the dealer’s hand before giving the player the choice to Hit or Stand. Once the player makes their choice, the program runs through. a series of conditionals checking the points for the player’s hand and the dealer’s hand to check for the winner.

Finally, once the winner of the hand is determined both hands are printed in the terminal with the point value of both the player and dealer’s hand. The player is then given the option to play again or quit the game. a score is tallied as the player continues to play.

Reflecting on this program there are a few things that I still need to fix and a few things I would change if I were to start over. first, My program only values an ace at 11 points, whereas in a true Blackjack game an ace can be 11 or 1 point. so I would like to fix this eventually. I would also redo my class for the deck of cards. in thinking about it, I think it would make more sense to create a card class to build individual cards and then build my deck from there. currently, I am not sure how I would do that, and I am ready to move on in the computer science course, so that will have to wait for another day. The biggest problem I had was connecting visual studio to my Github account for version control. this is something I am still working on.

Overall, I am pretty proud of what I accomplished with the project. It is by far the longest program I have written and the first time I have incorporated a class into a program. You can check out my program at this link: Blackjack game