Texas Referee
-- Mark Twain
Texas hold'em is a variation of the standard card game of poker. Two cards (hole cards) are dealt face down to each player and then five community cards are placed face-up by the dealer. And when all openings we need to define what is the combination a player have.
You are given a sequence of 7 cards and you should choose the best hand (5 cards) in it. Card sequence are described as a string, where each card are defined by two character - rank and suit. Cards separated by commas.
The descending ranks are: "A" (Ace), "K" (King), "Q" (Queen), "J" (Jack), "T" (Ten), and "9" to "2".
The descending suits are "h" (hearts), "d" (diamonds), "c" (clubs), "s" (spades).
Texas holdem uses the classical poker hand list : Straight flush, Four of a kind, Full house, Flush, Straight, Three of a kind, Two Pair, One Pair and High card.
Because of the presence of community cards in Texas hold 'em, different players' hands can often come very close in value. As a result, it is common for kickers to be used to determine the winning hand for cases where two or more hands tie. A kicker is a card which is part of the five-card poker hand, but is not used in determining a hand's rank. For instance, in the hand A-A-A-K-Q, the king and queen are kickers.
In our version of Texas Hold'em cards of differing suits have different values. This means that there is only ever one best five-card hand to return. So "Td" is higher than "Tc", but lower then "Jc".
Your goal is to choose the best hand with 5 cards and return them as a string, where cards are separated by commas and ordering from the highest to lowest value. For example: We have two pair by queens (heart and spades) and eights (diamonds and clubs) and nine heart as a kicker. The result: "Qh,Qs,9h,8d,8c". Be careful with order.
Input: A list of cards as a string.
Output: The best hand as a string.
How it is used: This concept is a good example of combinatorial optimisation process, and could come in handy should you make a poker game in Python.
Precondition:
cards_quantity == 7 All cards correct and unique.
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
checkio sync
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium
Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.
Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!
You are trying to join a pair programming session that has not started yet.
Please wait for the session creator to join.
It looks like the creator of the pair programming session closed the editor window.
It might happen accidentally, so that you can wait for reconnection.