Natasha's Class Hack Exercise

by Natasha Vazquez

13 Jun 2017

For this assignment, since I’m doing the data analysis for the final I decided to hack a text-based assignment and chose to remix the blackjack app I’d created preivously.

I decided to create a class called Cards that took care of all the card-based functions/methods needed for game play: instantiating the main deck, the player’s hand, and the dealer’s hand; dealing cards at random from the main deck to either the player’s hand or the dealer’s hand; getting the score for either the player or dealer; and formatting the hand to be shown the user. So this was really hard for me to do… I took a lot of time testing out code to see if it would work but for some reason it just wasn’t working. The readings were clear and it wasn’t difficult to understand the concept of a clas, but the execution was kind of difficult. After enough testing I finally got it to work (not sure if that means I totally understand how to do this or if I just got lucky). Changing out the old code for the class-based code allowed me to simplify the old code in a few places and to implement a feature that I wasn’t able to before (showing the user their hand), so that was nice.

Natasha is an MS student in information science at UNC Chapel Hill and a public health analyst in the Center for Communication Science at RTI International. She likes traveling and beer-ing. Find Natasha Vazquez on Twitter, Github, and on the web.