Blackjack

Base Comfortable More Comfortable

Please enter the number of players to start.
Description

Disclaimer

Rocket Academy does not endorse gambling. Blackjack's complex rules makes it a good project to teach coding.

Game

The goal of the game is to win points by creating card totals higher than the dealer's hand but not exceeding 21. The player can also stop at a total in the hope that dealer will exceed 21.

The game starts with everyone besides the dealer placing a bet.

Then, the dealer deals 1 card face up to each player and 1 card face up to themselves.

Everyone is dealt one more face-up card besides the dealer, whose second card is dealt face down.

Cards

Number cards are scored through their face value. Jacks, Queens, and Kings are all equal to 10. Aces count as either 1 or 11. A total that exceeds 21 is a bust and the player or dealer is out of the game.

Player Decisions

After the initial two cards, each player has up to three options: "hit", "stand", or "split".

  • Hit: Take another card.
  • Stand: Take no more cards, and it is the next player or dealer's turn.
  • Split: Create two hands from a starting hand where both cards are the same value. Each new hand gets another card so that the player has two starting hands. The second hand needs an additional bet. The two hands are played out independently, and the wager on each hand is won or lost independently. In the case of cards worth 10 points, only cards which are the same rank can be split. For example, 10-10 can be split, but K-10 cannot.

Dealer

After the players have finished playing, the dealer's hand is resolved by drawing cards until the hand achieves a total of 17 or higher. The dealer never splits.

If the dealer busts, all remaining player hands win. If the dealer does not bust, each remaining bet wins if its hand is higher than the dealer's and loses if it is lower.

Blackjack

A card total of 21 on the first two cards is a "blackjack," and the player wins immediately unless the dealer also has one, in which case the hand ties. A blackjack beats any hand that is not a blackjack, even one with a value of 21.

Points

Wins are paid out at even money, except for player blackjacks, which are paid out at 1.5 times the bet amount.

In the case of a tie ("push" or "standoff"), bets are returned without adjustment.

Credits

The rules of the game are adapted from Wikipedia

Base

  • Single Player Blackjack
  • Variable Ace Values

Comfortable

  • Better Output Formatting
  • Betting
  • Multiplayer

More Comfortable

  • Splits