Texas Referee

Texas Referee

There are few things that are so unpardonably neglected in our country as poker. The upper class knows very little about poker. Now and then you find ambassadors who have sort of a general knowledge of poker, but the ignorance of the people is fearful. Why, I have known clergymen, good men, kind-hearted, liberal, sincere, and all that, who did not know the meaning of a "flush". It is enough to make one ashamed of the species.
-- 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.

Example:

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.
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

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.

Pair Programming (Beta-version)

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!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

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.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission