Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Blackjack with 3 different methods #203

Closed
wants to merge 1 commit into from

Conversation

EpicNesh26
Copy link

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.

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.

Blackjack.py : 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.

@EpicNesh26 EpicNesh26 closed this by deleting the head repository May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant