Skip to main content

Blackjack game

Project description

Blackjack

Objective

Having a higher sum than the dealer's hand.

Card Values

  • Numeric cards (2-10): The value is as indicated by the number shown.
  • Face cards (Jack, Queen, King): Each has a value of 10.
  • Ace: Can be set to either 1 or 11.

Game Flow

  • Deal the cards
    • The player and the dealer are each dealt two cards. The player's cards are both face up, while the dealer's is one face up and the other face down.
  • Player's Choice
    • Hit: Draw another card.
    • Stand: Play with the current hand.
  • Dealer's Turn
    • The dealer turns the face-down cards face up and draws cards until he has 17 or more.
  • Winner Decides
    • If the total hand exceeds 21, then loses on a “bust”.
    • When the dealer busts, the remaining player wins.
    • If the hand is high, then wins.
    • If the hands are the same, then tie.

How to play

$ blackjackpy
Player( 6):  2(C) 4(S)
Dealer(--):  5(C) *(*)
Hit? (y/n) y
Player(16):  2(C) 4(S) J(C)
Dealer(--):  5(C) *(*)
Hit? (y/n) n
Player(16):  2(C) 4(S) J(C)
Dealer(17):  5(C) 3(C) 9(S)
You lose.
$ blackjackpy
Player(20): 10(S) K(C)
Dealer(--):  7(C) *(*)
Hit? (y/n) n
Player(20): 10(S) K(C)
Dealer(18):  7(C) A(H)
You win.

Ref.

See: https://pyq.jp/quests/blackjack/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

blackjackpy-0.2.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file blackjackpy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: blackjackpy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for blackjackpy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09fa3242daafda48b5d2b49a6bbc0e8e885567e12f5f46b825de9588e3b5ebe6
MD5 b8ab57816eb71e3073cb3e74209a0d49
BLAKE2b-256 918b74384b78786ab3324174fa174f2bd2bfbb63cf282bf92440a8544e312d0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page