cards v0.1.0 Cards

Provides methods for creating and handling a deck of cards

Summary

Functions

Determines whether a deck contains a given card

Returns a list of strings representing a deck of playing cards

Divides a deck into a hand and the remainder of the deck. The hand_size argument indicates how many cards should be in the hand

Functions

contains?(deck, card)

Determines whether a deck contains a given card

Examples

iex> deck = Cards.create_deck
iex> Cards.contains?(deck, "Ace of Spades")
true
create_deck()

Returns a list of strings representing a deck of playing cards

create_hand(hand_size)
deal(deck, hand_size)

Divides a deck into a hand and the remainder of the deck. The hand_size argument indicates how many cards should be in the hand.

Examples

iex> deck = Cards.create_deck
iex> {hand, deck} = Cards.deal(deck, 1)
iex> hand
["Ace of Spades"]
load(filename)
save(deck, filename)
shuffle(deck)