Question: Question 7 - ( Hard ) ( worth 1 0 points - 2 points for getting the right output on the test data and another
Question Hardworth points points for getting the right output on the test data and another for the hidden data see the first page for more detail!
In this question, we are looking at the poker hands. In this case, they are all different card hands.
A poker hand has one of the following values:
Straightflush: The hand is both straight and flush, see below
Four of a kind: There are of some card rank
Full house: There are of some card rank and two of another
Flush: All suits are the same but it is not a straightflush
Straight: The card ranks are consecutive eg the card ranks form the set OR the cards ranks form the set Finally, the hand is not also a flush because it would then be a straightflush
Three of a kind: There are of a card rank
Two pairs: There are two of one card rank and two of another but it is not a full house
Pair: There are two of one card rank but not any of the above
High card: None of the above
While the above is the ordering of hands in poker earlier being better since we are not comparing hands but simply trying to find their value, it does not matter.
You are simply meant to for each hand, determine its value. The output is supposed to be h id handvalue handvalue where handvalue and handvalue depends on the type of hand, see below:
Each hand which is a Straightflush, Flush or Straight, should be such that handvalue 'Straight' if the hand is straight and handvalue otherwise. Also, if it is a Flush, handvalue 'Flush' and handvalue otherwise.
Each hand which is a Four of a kind, Full house, Three of a kind, Two pairs or pair, should be such that handvalue is how many there are of the rank of which there are the most. Also, handvalue is how many there are of the rank of which there are the second most or equivalently, how many ranks there are two or more of Eg Four of a kind has handvalue and handvalue and Full house has handvalue and handvalue
Each hand which is a High card has handvalue 'High' and handvalue 'Card'.
While it is unlikely to be a good idea to make just one view for this question you could if you felt it was the better solution, but I am fairly sure it is not one of the explicit challenges in this question is that there is no suggested set of views to make.
If you look in the public test data, each hand has its value written on it as a comment. So eg'Hearts','Hearts',
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
