Skip to content

DrAcula27/blackjack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Blackjack

Play blackjack - you versus the dealer!
View Demo

Table of Contents
  1. About The Project
  2. Usage
  3. Optimizations
  4. Lessons Learned
  5. Contact
  6. Acknowledgments

About The Project

Blackjack Screen Shot

The objective of Blackjack, also known as Twenty-One, is to beat the dealer by getting a hand value closer to 21 than the dealer's hand, without going over 21.

At the start of a blackjack game, the players and the dealer receive two cards each. The best possible blackjack hand is an opening deal of an ace with any ten-point card. This is called a "blackjack", or a natural 21, and the player holding this automatically wins unless the dealer also has a blackjack. If a player and the dealer each have a blackjack, the result is a tie (push).

If the dealer has a blackjack and the player does not, the player loses.

(back to top)

Built With

  • HTML5
  • CSS3
  • JavaScript

(back to top)

Usage

The basic rules of the game are:

  1. Player Turn. After the cards have been dealt, the game goes on with the player taking action. The player can keep their hand as it is (stand) or take more cards from the deck (hit), one at a time, until either the player judges that the hand is strong enough to go up against the dealer's hand and stands, or until it goes over 21, in which case the player immediately loses (busts).
  2. Dealer Turn. When the player has finished their actions, either decided to stand or busted, it is the dealer's turn. If the dealer has a natural 21 (blackjack) with their two cards, they won't take any more cards. The player loses, unless they also have a blackjack, in which case it is a tie (push). If the dealer doesn't have a natural blackjack, the dealer hits (takes more cards) or stands depending on the value of the hand. Contrary to the player, though, the dealer's action is completely dictated by the rules. The dealer must hit if the value of the hand is lower than 17, otherwise the dealer must stand.
  3. Winning.
  • Blackjack: If your first two cards are an Ace and a 10-value card (10, Jack, Queen, King), this is an automatic win (Blackjack).
  • Higher Value than Dealer: If your hand total is closer to 21 than the dealer's hand total without going bust, you win.
  • Dealer Busts: If the dealer's hand total goes over 21 (busts), you win regardless of your hand value.
  • Push: If your hand total equals the dealer's hand total, it's a tie (push).
  • Lower Value than Dealer: If the dealer's hand total is closer to 21 than yours without busting, you lose.

(back to top)

Optimizations

This project can be improved by:

  • Adding multiple players
  • Allowing multiple players to continue playing if the dealer busts
  • Adding variations
    • Insurance
    • Surrender
    • Splitting
    • Doubling Down
  • Adding betting
  • Keeping score for multiple rounds

(back to top)

Lessons Learned

  • API Integration. I got more practice reading API docs and using them to get good data back.
  • Data Manipulation. I practiced manipulating the data by assigning numerical values to face cards.
  • Keeping Functions Small and Reusable. I kept my functions simple so they could be reused throughout my code.

(back to top)

Contact

Danielle Andrews - @DrAcula_codes - daniellerandrews - danielle.andrews.dev@icloud.com

Project Link: https://github.com/DrAcula27/blackjack

(back to top)

Acknowledgments

A special thanks to these resources used in the project!

(back to top)