wojtekmach / poker_elixir

An Elixir library to work with Poker hands.
http://hexdocs.pm/poker/
5 stars 3 forks source link

Possible defect: twos don't get recognized for hands? #1

Open Trevoke opened 7 years ago

Trevoke commented 7 years ago

I'm creating a system that has multiple decks, and this just happened:

iex(66)> hand = cards_from_many_decks |> Enum.shuffle |> Enum.take(5) |> Enum.join(" ")
"2s Ts 5s Kd 2s"
iex(67)> Poker.hand_rank(hand)
{:high_card, :K, :T, 5, 2, 2}

I expected this to be a pair of twos.

So I tried this:

iex(72)> Poker.hand_rank("2s 2c 2d 4c 5d")
{:high_card, 5, 4, 2, 2, 2}

I thought this would be a three of a kind, but it isn't.

Is this a defect?

wojtekmach commented 7 years ago

It is def a defect, I will look into it W dniu pon., 13.03.2017 o 22:49 Aldric Giacomoni notifications@github.com napisał(a):

I'm creating a system that has multiple decks, and this just happened:

iex(66)> hand = cards_from_many_decks |> Enum.shuffle |> Enum.take(5) |> Enum.join(" ")"2s Ts 5s Kd 2s" iex(67)> Poker.hand_rank(hand) {:high_card, :K, :T, 5, 2, 2}

I expected this to be a pair of twos.

So I tried this:

iex(72)> Poker.hand_rank("2s 2c 2d 4c 5d") {:high_card, 5, 4, 2, 2, 2}

I thought this would be a three of a kind, but it isn't.

Is this a defect?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wojtekmach/poker_elixir/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEpJ36MeojjZZx7smuqguwaW__ZVoCLks5rlboDgaJpZM4Mb3Pk .