This README provides examples of how to use the Deck
class which simulates a deck of cards with various functionalities like shuffling, dealing, and tracking cards.
from deck_module import Deck # Make sure the class is in a module named deck_module.py
# Create a new deck of cards
deck = Deck()
The deck is automatically shuffled when it is initialized. However, you can shuffle it again at any time using:
deck.shuffle()
To deal a single card from the deck:
card = deck.deal()
print(card) # Outputs a card in the format "value-suit", e.g., "13-h"
To print all cards currently in the deck and see the total count:
deck.checkDeck()
To get the current number of cards in the deck:
count = deck.cardinality()
print(count)
To get an array representing the negated deck (i.e., cards that have been dealt so far):
negated_deck = deck.negation()
print(negated_deck) # Outputs an array of 0s and 1s representing the status of each card
Each method of the Deck
class allows interaction with the deck of cards, mimicking real-world actions like shuffling and dealing, as well as tracking cards that have been used.