Blackjack

May 21, 2017

Blackjack's one of the games I played with my Grandma in our motorhome one summer as my family was moving. I remember the deck of cards we used was a Coca-Cola branded deck with a yellow card back (in search for a reference I think I just found it on Amazon here). The game was pretty straight-forward, try to get your hand value as close to 21 without going over. We didn't play with rules you'd find in Vegas, like doubling down and splitting, we just played to 21.

I decided to implement this using just plain old JavaScript. At work we use a JS framework that I'm told was produced by Digg.com years ago with jQuery mixed in. We've updated it to Backbone.js technically but it's still heavily influenced by the old Digg.com framework. I had never really played around with pure JS, so this was a chance to do that. I also used CSS media queries to help scale things appropriately which gave me a little insight on how modern responsive web frameworks actually work behind the scenes.

The current version of blackjack below is simple and more or less still in a prototype stage (so forgive me that the dealer's second card isn't hidden but instead revealed to the player at this point). It's been fun creating cards with CSS and learning about how Object-Oriented design is done with pure JS. As I keep working on this I plan to add those Vegas rules I mentioned above, as well as a little animation and some polish. But for now, here's my version of blackjack. Have fun!

How to Play

To start the game press the "Play Game" button. You'll start first, so you can chose to "Hit Me!" or "Stand". Upon choosing to stand the dealer will play his turn. Then once you determine a winner you can press the "Next Hand" button to play again. If a player draws 21 that hand ends immediately. Remember this is just an in-progress prototype, so you might run across some weirdness (which there is with changing screen sizes dynamically). Thanks for playing!

BLACKJACK PAYS 3 TO 2

DEALER MUST DRAW TO 16 AND STAND ON ALL 17'S

INSURANCE PAYS 2 TO 1

Helpful References