Sha256: e45333584b4f521af63b51e503ca3b7eb96ef88d55fb89421c54415363da99da
Contents?: true
Size: 1.21 KB
Versions: 69
Compression:
Stored size: 1.21 KB
Contents
defmodule Poker do @doc """ Given a list of poker hands, return a list containing the highest scoring hand. If two or more hands tie, return the list of tied hands in the order they were received. The basic rules and hand rankings for Poker can be found at: https://en.wikipedia.org/wiki/List_of_poker_hands For this exercise, we'll consider the game to be using no Jokers, so five-of-a-kind hands will not be tested. We will also consider the game to be using multiple decks, so it is possible for multiple players to have identical cards. Aces can be used in low (A 2 3 4 5) or high (10 J Q K A) straights, but do not count as a high card in the former case. For example, (A 2 3 4 5) will lose to (2 3 4 5 6). You can also assume all inputs will be valid, and do not need to perform error checking when parsing card values. All hands will be a list of 5 strings, containing a number (or letter) for the rank, followed by the suit. Ranks (lowest to highest): 2 3 4 5 6 7 8 9 10 J Q K A Suits (order doesn't matter): C D H S Example hand: ~w(4S 5H 4C 5D 4H) # Full house, 5s over 4s """ @spec best_hand(list(list(String.t()))) :: list(list(String.t())) def best_hand(hands) do end end
Version data entries
69 entries across 69 versions & 1 rubygems