Blackjack Progress#1 & #2 [Penzu]
It’s Thursday today and I was able to add some more functionality to the blackjack.js I created on Monday.
I managed to create the basic structure of a blackjack game; a deck of 52 cards (an array with 52 objects inside with values and names applied), a method of adding cards into hands (two arrays, dealer and player hands, controlled by buttons to splice from the deck and push into hands), and method of starting the game and doing an initial draw of 2 cards each.
Visually it looked pretty basic but the functionality was there.
Today, I managed to take it further, creating multiple functions to extract the actual values inside the card objects and make these values add together to form the total score. This took a while to figure out; I had to iterate the arrays using a for loop and then take the values and add them to the screen and initially, it wasn’t working.
I figured out the I wasn’t “drilling down” far enough to get to the values.
I also created the function to determine whether the dealer of the player has bust or not.
Next steps will be to work out the Ace value (1 or 11) and figure out a way of visualising the cards that have been drawn.
Additional features I’d like to add:
Splits: creating extra hands when duplicate cards are drawn
Stay and Fold functions; currently, there is only one button to hit and a separate button to start the game
Poker chips or some form of cash/betting system
I’m super chuffed by my progress considering I did nothing Tuesday and Wednesday. I’m really enjoying the methodology of breaking a product down into its base functions and creating it from scratch.