GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Nash2610/Python-Blackjack-game: This is a Python script for a simple text-based Blackjack game. The script defines several classes to represent the game's components, including Card, Deck, Hand, and Game.

BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
BlackJack.py
BlackJack.py
 
 
Method1.py
Method1.py
 
 
Method2.py
Method2.py
 
 
README.md
README.md
 
 

Repository files navigation

Python-Blackjack-game

To clone the repository and run it locally, follow these steps:

  1. Open your terminal or command prompt.
  2. Navigate to the directory where you want to clone the repository using the cd command.
  3. Use the git clone command:
    https://github.com/EpicNesh26/Python-Blackjack-game.git
  4. Once the repository is cloned, navigate into the repository directory using the cd command.
  5. You can now run the script locally. Depending on the programming language, you might need to have the necessary runtime or dependencies installed on your system.
  6. Execute the script using the appropriate command or interpreter for the specific language. For example, if it's a Python script, you can run it using the python command followed by the script name:

Introduction to Blackjack:

Blackjack, or 21, is a casino card game where players aim to beat the dealer by getting a hand value close to 21 without exceeding it. Number cards are worth their face value, face cards 10 points, and Aces 1 or 11 points

Method 1

This Python script simulates dealing cards from a 52-card deck. It uses the random module to shuffle the deck, which is a list of cards created from the suits ("Spades," "Clubs," "Hearts," "Diamonds") and ranks ("A," "2"-"10," "J," "Q," "K"). The deal function distributes a specified number of cards. The script shuffles the deck, deals four cards, and determines each card's value, printing the results. https://github.com/EpicNesh26/Python-Blackjack-game/blob/684cb2c5a1367c58e9ac191fd4ee27cb96fe5611/Method1.py#L7-L18

Method 2

This Python script simulates a deck of cards and a dealing function. It uses the random module to shuffle the deck, consisting of suits ("Spades," "Clubs," "Hearts," "Diamonds") and ranks with corresponding values. The deck is built by combining suits and ranks, then shuffled. The deal function returns a specified number of cards from the top of the shuffled deck. The script demonstrates deck creation, shuffling, and card dealing, and prints the dealt card's suit and rank. https://github.com/EpicNesh26/Python-Blackjack-game/blob/a97b11e177df968b8663d8e78bea44c3b622821e/Method2.py#L6-L25

Final Code

This Python script implements a text-based Blackjack game with several classes:

Card: Represents a playing card with a suit and rank. Deck: Represents a deck of cards, which can be shuffled and dealt. Hand: Represents a hand of cards, managing dealt cards and calculating their value. Game: Manages the overall Blackjack game. 'check_winner' function determines the winner based on the player's and dealer's hand values.

The main part of the script creates a Game object and calls its play method to start the game. The play method prompts the user to enter the number of games to play, then plays each game by dealing two cards to both the player and the dealer, allowing the player to hit or stand, and determining the winner based on the final hand values. https://github.com/EpicNesh26/Python-Blackjack-game/blob/e3245c00548da2a9ba382fd49b61b45fd2f65807/BlackJack.py#L48-L66

About

This is a Python script for a simple text-based Blackjack game. The script defines several classes to represent the game's components, including Card, Deck, Hand, and Game.

Topics

blackjackblackjack-pythonoopoops-in-pythonpythonpython3

Resources

Readme
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.