Created
November 18, 2016 13:55
-
-
Save paulohp/f6803bd8ec3df9ad0ad95cfdc2e7b31b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Cards do | |
def create_deck do | |
values = ["Ace", "Two", "Three"] | |
suits = ["Spades", "Clubs", "Hearts", "Diamonds"] | |
for value <- values, suit <- suits do | |
"#{value} of #{suit}" | |
end | |
end | |
def shuffle(deck) do | |
Enum.shuffle(deck) | |
end | |
def contains?(deck, card) do | |
Enum.member?(deck, card) | |
end | |
def deal(deck, hand_size) do | |
Enum.split(deck, hand_size) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment