Skip to content

jscdev909/Blackjack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Blackjack

Recording2026-04-25003047-ezgif com-video-to-webp-converter

The classic casino game of Blackjack, implemented as a console-based script in Python! Another small game I created in the middle of maintaining my other bigger game projects. Can you beat the dealer, or will the house win once again?

Background

Blackjack is a card game played between one or more players and a dealer where the aim is to get a hand worth 21 points. Numbered cards are worth their number in points, face cards are worth ten points each, and aces are worth either 1 or 11 points each. Suits are not taken into account and jokers are not used. Each player is dealt a two card hand and the dealer is dealt a two card hand with one card hidden to the other players. During a players turn, they will either hit (get dealt another card) or stand (keep their current hand) to try to get their hand total as close to 21 as possible. If a players hand goes over 21 points, they bust and immediately lose. If a player receives a 21 with only the two cards they were initially dealt, this is called a natural blackjack. A natural blackjack automatically wins the game for the player unless the dealer also has a natural blackjack, in which case the game is a standoff (a tie). Natural blackjacks also beat any 21 point hand that is constructed with 3 or more cards (so it's still possible for the dealer to win even if the player has a 21 point hand). After the players turn there is always a dealers turn where the dealer first reveals their hidden card then also tries to get their hand as close to 21 as possible. After the dealer stands, whoever has the hand with the higher point total wins, unless the totals are equal, in which case it's a standoff (a tie).

Features

  • New random deck created each time a new game is played for a different game experience each time
  • All player/dealer win/lose/tie scenarios implemented (player blackjack, dealer blackjack, player and dealer have blackjack, etc.)
  • Total points for a hand are re-calculated and shown with every move (for both player moves and dealer moves)
  • Multiple possible point totals for a hand printed out if aces are present, so no more second-guessing the possible totals!
  • No external dependencies, you only need Python 3.14 to play!

Setup

Make sure Python 3.14 is installed and the interpreter executable is available on your PATH (running py --version is a good check for this). Then either download the blackjack.py script directly from the repo or clone the repository. Change directories in your terminal to the directory where the blackjack.py script is and then run:

py blackjack.py

Then just follow the given prompts to play! Enjoy!

About

The classic casino game of Blackjack, now as a console-based Python script

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages