Deck

Represents a deck of cards. Attributes: cards: list of Card objects.

Methods

init

Initializes the Deck with 52 cards.

Parameters

namedescriptiondefault

self

str

Returns a string representation of the deck.

Parameters

namedescriptiondefault

self

add_card

Adds a card to the deck. card: Card

Parameters

namedescriptiondefault

self

card

remove_card

Removes a card from the deck or raises exception if it is not there. card: Card

Parameters

namedescriptiondefault

self

card

pop_card

Removes and returns a card from the deck. i: index of the card to pop; by default, pops the last card.

Parameters

namedescriptiondefault

self

i

shuffle

Shuffles the cards in this deck.

Parameters

namedescriptiondefault

self

sort

Sorts the cards in ascending order.

Parameters

namedescriptiondefault

self

move_cards

Moves the given number of cards from the deck into the Hand. hand: destination Hand object num: integer number of cards to move

Parameters

namedescriptiondefault

self

hand

num

Last updated