{ "exercise": "poker", "version": "1.1.0", "cases": [ { "description": "single hand always wins", "property": "bestHands", "input": { "hands": [ "4S 5S 7H 8D JC" ] }, "expected": [ "4S 5S 7H 8D JC" ] }, { "description": "highest card out of all hands wins", "property": "bestHands", "input": { "hands": [ "4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH" ] }, "expected": [ "3S 4S 5D 6H JH" ] }, { "description": "a tie has multiple winners", "property": "bestHands", "input": { "hands": [ "4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" ] }, "expected": [ "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" ] }, { "description": "multiple hands with the same high cards, tie compares next highest ranked, down to last card", "property": "bestHands", "input": { "hands": [ "3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S" ] }, "expected": [ "3S 5H 6S 8D 7H" ] }, { "description": "one pair beats high card", "property": "bestHands", "input": { "hands": [ "4S 5H 6C 8D KH", "2S 4H 6S 4D JH" ] }, "expected": [ "2S 4H 6S 4D JH" ] }, { "description": "highest pair wins", "property": "bestHands", "input": { "hands": [ "4S 2H 6S 2D JH", "2S 4H 6C 4D JD" ] }, "expected": [ "2S 4H 6C 4D JD" ] }, { "description": "two pairs beats one pair", "property": "bestHands", "input": { "hands": [ "2S 8H 6S 8D JH", "4S 5H 4C 8C 5C" ] }, "expected": [ "4S 5H 4C 8C 5C" ] }, { "description": "both hands have two pairs, highest ranked pair wins", "property": "bestHands", "input": { "hands": [ "2S 8H 2D 8D 3H", "4S 5H 4C 8S 5D" ] }, "expected": [ "2S 8H 2D 8D 3H" ] }, { "description": "both hands have two pairs, with the same highest ranked pair, tie goes to low pair", "property": "bestHands", "input": { "hands": [ "2S QS 2C QD JH", "JD QH JS 8D QC" ] }, "expected": [ "JD QH JS 8D QC" ] }, { "description": "both hands have two identically ranked pairs, tie goes to remaining card (kicker)", "property": "bestHands", "input": { "hands": [ "JD QH JS 8D QC", "JS QS JC 2D QD" ] }, "expected": [ "JD QH JS 8D QC" ] }, { "description": "three of a kind beats two pair", "property": "bestHands", "input": { "hands": [ "2S 8H 2H 8D JH", "4S 5H 4C 8S 4H" ] }, "expected": [ "4S 5H 4C 8S 4H" ] }, { "description": "both hands have three of a kind, tie goes to highest ranked triplet", "property": "bestHands", "input": { "hands": [ "2S 2H 2C 8D JH", "4S AH AS 8C AD" ] }, "expected": [ "4S AH AS 8C AD" ] }, { "description": "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards", "property": "bestHands", "input": { "hands": [ "4S AH AS 7C AD", "4S AH AS 8C AD" ] }, "expected": [ "4S AH AS 8C AD" ] }, { "description": "a straight beats three of a kind", "property": "bestHands", "input": { "hands": [ "4S 5H 4C 8D 4H", "3S 4D 2S 6D 5C" ] }, "expected": [ "3S 4D 2S 6D 5C" ] }, { "description": "aces can end a straight (10 J Q K A)", "property": "bestHands", "input": { "hands": [ "4S 5H 4C 8D 4H", "10D JH QS KD AC" ] }, "expected": [ "10D JH QS KD AC" ] }, { "description": "aces can start a straight (A 2 3 4 5)", "property": "bestHands", "input": { "hands": [ "4S 5H 4C 8D 4H", "4D AH 3S 2D 5C" ] }, "expected": [ "4D AH 3S 2D 5C" ] }, { "description": "both hands with a straight, tie goes to highest ranked card", "property": "bestHands", "input": { "hands": [ "4S 6C 7S 8D 5H", "5S 7H 8S 9D 6H" ] }, "expected": [ "5S 7H 8S 9D 6H" ] }, { "description": "even though an ace is usually high, a 5-high straight is the lowest-scoring straight", "property": "bestHands", "input": { "hands": [ "2H 3C 4D 5D 6H", "4S AH 3S 2D 5H" ] }, "expected": [ "2H 3C 4D 5D 6H" ] }, { "description": "flush beats a straight", "property": "bestHands", "input": { "hands": [ "4C 6H 7D 8D 5H", "2S 4S 5S 6S 7S" ] }, "expected": [ "2S 4S 5S 6S 7S" ] }, { "description": "both hands have a flush, tie goes to high card, down to the last one if necessary", "property": "bestHands", "input": { "hands": [ "4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S" ] }, "expected": [ "4H 7H 8H 9H 6H" ] }, { "description": "full house beats a flush", "property": "bestHands", "input": { "hands": [ "3H 6H 7H 8H 5H", "4S 5H 4C 5D 4H" ] }, "expected": [ "4S 5H 4C 5D 4H" ] }, { "description": "both hands have a full house, tie goes to highest-ranked triplet", "property": "bestHands", "input": { "hands": [ "4H 4S 4D 9S 9D", "5H 5S 5D 8S 8D" ] }, "expected": [ "5H 5S 5D 8S 8D" ] }, { "description": "with multiple decks, both hands have a full house with the same triplet, tie goes to the pair", "property": "bestHands", "input": { "hands": [ "5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D" ] }, "expected": [ "5H 5S 5D 9S 9D" ] }, { "description": "four of a kind beats a full house", "property": "bestHands", "input": { "hands": [ "4S 5H 4D 5D 4H", "3S 3H 2S 3D 3C" ] }, "expected": [ "3S 3H 2S 3D 3C" ] }, { "description": "both hands have four of a kind, tie goes to high quad", "property": "bestHands", "input": { "hands": [ "2S 2H 2C 8D 2D", "4S 5H 5S 5D 5C" ] }, "expected": [ "4S 5H 5S 5D 5C" ] }, { "description": "with multiple decks, both hands with identical four of a kind, tie determined by kicker" , "property": "bestHands", "input": { "hands": [ "3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C" ] }, "expected": [ "3S 3H 4S 3D 3C" ] }, { "description": "straight flush beats four of a kind", "property": "bestHands", "input": { "hands": [ "4S 5H 5S 5D 5C", "7S 8S 9S 6S 10S" ] }, "expected": [ "7S 8S 9S 6S 10S" ] }, { "description": "both hands have straight flush, tie goes to highest-ranked card", "property": "bestHands", "input": { "hands": [ "4H 6H 7H 8H 5H", "5S 7S 8S 9S 6S" ] }, "expected": [ "5S 7S 8S 9S 6S" ] } ] }