4 kyu
Ranking Poker Hands
1,271 of 3,493FrankK
Description:
A famous casino is suddenly faced with a sharp decline of their revenues. They decide to offer Texas hold'em also online. Can you help them by writing an algorithm that can rank poker hands?
Task
Create a poker hand that has a method to compare itself to another poker hand:
compare_with(self, other_hand)
A poker hand has a constructor that accepts a string containing 5 cards:
PokerHand("KS 2H 5C JD TD")
The characteristics of the string of cards are:
- Each card consists of two characters, where
- The first character is the value of the card:
2, 3, 4, 5, 6, 7, 8, 9, T(en), J(ack), Q(ueen), K(ing), A(ce)
- The second character represents the suit:
S(pades), H(earts), D(iamonds), C(lubs)
- A space is used as card separator between cards
The result of your poker hand compare can be one of these 3 options:
[ "Win", "Tie", "Loss" ]
Notes
- Apply the Texas Hold'em rules for ranking the cards.
- Low aces are valid in this kata.
- There is no ranking for the suits.
If you finished this kata, you might want to continue with Sortable Poker Hands
Games
Algorithms
Object-oriented Programming
Similar Kata:
Stats:
Created | May 16, 2016 |
Published | May 16, 2016 |
Warriors Trained | 26966 |
Total Skips | 10636 |
Total Code Submissions | 46790 |
Total Times Completed | 3493 |
C# Completions | 482 |
Java Completions | 574 |
F# Completions | 33 |
JavaScript Completions | 670 |
C Completions | 118 |
C++ Completions | 274 |
Python Completions | 1271 |
Elixir Completions | 32 |
Ruby Completions | 93 |
Total Stars | 1153 |
% of votes with a positive feedback rating | 92% of 721 |
Total "Very Satisfied" Votes | 629 |
Total "Somewhat Satisfied" Votes | 72 |
Total "Not Satisfied" Votes | 20 |
Total Rank Assessments | 8 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 6 kyu |