This is an over-simplified, crude version of Blackjack. It's actually more along the lines of the classic card games Twenty-One or Pontoon, but doesnt really follow the rules of any one of these games.
You can play the game directly in your browser or download the desktop app for your operating system.
https://devklick.github.io/basic-blackjack/
Download the relevant installer from the releases page. Note that at this time, only Windows and Linux operating systems are supported. Note that the installers are not currently signed and likely never will be. Your operating system will likely throw up all sorts of warnigs and installing an unknown application. The risk is yours.
This game is a React app packaged as a desktop app using Electron. To run the react app, simply run npm start
. To run the desktop app, run npm dev
. To run the tests, write them first.
The idea is to end up with between 2 and 5 cards who's rank total 21 or less. The winner will be determined based on the hand rank, the numer of cards in the hand, and the highest card. See the Ways to win section.
The game contains two players; the player (you) and the dealer (computer). The dealer will start by dealing four cards:
- Deal 1 card to player, facing up
- Deal 1 card to dealer, facing up
- Deal 1 card to player, facing up
- Deal 1 card to dealer, facing down
The player will then have a chance to decide whether they want to hit (receive another card, face up) or stick (stick with their current cards). If they decide to hit, their cards will either total 21 or less, in which case they get to decide whether to hit or stick again (up to a total of 3 times), or they will be bust (their cards total exceed 21), in which case they loose and the dealer automatically wins.
If the player decides to stick, it's over to the dealer (computer). First, their second card, which was facing down until this point, will be turned face up. The dealer (computer) then decides whether they want to hit or stick, just like the player. The only differences are that:
- The dealer must hit if their score is less than 16
- The dealer must hit if their score is less than the players score
At the end of the dealers round, either the player or dealer will have won.
There's a few ways in which a result is reached:
- Player's hand exceeds 21, dealer automatically wins (or vis versa)
- Player's hand is less than or equal to 21 and contains 5 cards, winner automatically wins (or vis versa)
- Player's hand value exceeds dealers hand value, player wins (or vis versa)
- Player's hand value and dealers hand value are the same but player has more cards, player wins (or vis versa)
- Player's hand value and dealers hand value are the same and both have the same number of cards, but player has a higher card, player wins (or vis versa)
- Player's hand value and dealers hand value are the same and both have the same number of cards and neither has a highest card, game reaches a draw.
Selecting stick when your hand totals 10 or less will cause a popup to will appear asking to if you're sure you want to stick with your current score. You can select yes or no.
Likewise, selecting hit when your hand totals 18 or more will cause the same popup to appear, asking if you're sure you want another card. You can select yes or no.
The "current best hand score" is updated every time a card is dealt. As an Ace can be treated as a 1 or 11, the relevant value is selected to get the hand as close to 21 as possible without exceeding it.
The total wins are also tracked, so you will see how many times the dealer has whooped your ass (at least in my case). This information is not preserved between screen refreshes.
- Improve card dealing animation (delay between each card being dealt).
- Have an option to disable popups entirely.
- Store total wins (history) in cache so it's preserved between refreshes.
- Introduce betting.