This is a simple Blackjack game built using HTML, CSS, and JavaScript. It follows the basic rules of Blackjack, where the player and dealer are dealt two cards each and the goal is to get as close to 21 points as possible without going over. The player can choose to "hit" and receive another card, or "stand" and keep their current hand. The dealer must continue to hit until their hand reaches 17 points or higher.
To play the game, simply open the index.html file in a web browser. The game will be displayed in the browser window and can be played using the mouse.
- Click on the banner when the game launches.
- Set the bet amount. You can bet 0.
- Deal two cards to both the player and the dealer.
- The player can choose to hit or stand by clicking the corresponding button.
- If the player chooses to hit, they will receive another card.
- If the player chooses to stand, the dealer will start hitting until their hand reaches 17 points or higher.
- If the dealer's hand exceeds 21 points, the player wins the game.
- If the dealer's hand is higher than the player's hand without exceeding 21 points, the player loses the game.
- If the player and dealer have the same score, the game is a "push" and the player's bet is returned.
- Uses 100% Vanilla JavaScript, without any libraries.
- Follows functional programming principles.
- Generates game cards with a JavaScript Class and CSS.
- Displays the current card values of the player and the dealer.
- After each round, the UI displays the outcome.
This project is licensed under the MIT License. See the LICENSE file for details.
This project incorporates code snippets and logic from various sources. All of the logic has been rewritten or converted from other languages/frameworks to vanilla JavaScript. Some functions have been rewritten by combining logic from multiple sources, while others have been taken from the source and improved for consistency and readability.
- https://scrimba.com/playlist/p3py7U7
- https://github.com/jacquelynmarcella/blackjack
- https://wsvincent.com/javascript-object-oriented-deck-cards/
- https://www.youtube.com/watch?v=Bj6lC93JMi0
- https://www.youtube.com/watch?v=NxRwIZWjLtE
- https://www.youtube.com/watch?v=bMYCWccL-3U&t=1845s
- https://github.com/jarodburchill/blackjack-react-app
- https://github.com/chirag-23/Black-Jack-Game
- https://codepen.io/pmk/pen/GgrJRq (Poker chips)
and numerious Google searches and indie blogs.
- Some functions will be combined to reduce number of functions
- CSS Framework will be adopted for consistency and improved design
- Mobile version will be made
- High Score system will be implemented and perform local save
- Difficulty settings
- Import cards as Json
- Re-write using TypeScript
- Easter eggs