+ 2

# Can someone help me in poker hand code coach please? I can't pass test case #5 and #6 .

https://sololearn.com/compiler-playground/cr7O1M39ftR3/?ref=app

7th Aug 2024, 7:12 AM
+ 2
MULUKEN ADDIS Did you check the output too? " Full House" is not the same as "Full House". Any extra space can make it not passing the test. Also, from the task description, it says: High Card: Highest vale card (from 2 to Ace) My interpretation is 2 is the lowest value, and Ace is the highest value. So, Ace cannot be the highest and the lowest value (1) at the same time.
8th Aug 2024, 9:56 AM
Wong Hei Ming
+ 3
MULUKEN ADDIS You sure? I remove all the extra spaces from line 285 to line 303, and it passes all testes. As mentioned earlier, " Full House" is not the same as "Full House".
8th Aug 2024, 2:42 PM
Wong Hei Ming
+ 1
To test your code, it is best to give a test case for your functions. Try: 10S JS QS KS AS 10S JS QS KS 9S
7th Aug 2024, 12:35 PM
Wong Hei Ming
+ 1
MULUKEN ADDIS The first clearly is a royal flush, of course. From the task description, Flush: All cards of the same suit. But the second is a Straight Flush: All cards are consecutive values of same suit. (9, 10, J, Q, K) The idea is, you have a data, and you know the answer. Feed that data into your program and see does it produce the result you are expecting.
7th Aug 2024, 10:40 PM
Wong Hei Ming
+ 1
MULUKEN ADDIS It is an interesting idea. To my understanding, however, it is a Flush, and my solution told me so. It is because the number start from 2 and end with A. AS 2S 3S 4S 5S, which means we have 4 consecutive values starting from head (2, 3, 4, 5), plus an "A" which happens to be the tail of the possible values. Maybe you can think of this way. We replace J, Q, K and A with 11, 12, 13 and 14. Then "AS 2S 3S 4S 5S" becomes "14S 2S 3S 4S 5S", not 5 consecutive values.
8th Aug 2024, 5:57 AM
Wong Hei Ming
7th Aug 2024, 7:14 AM
0
Wong Hei Ming that is not the error. the first is royal flush , the second is flush and my code gives me that.
7th Aug 2024, 5:03 PM
0
Wong Hei Ming you mean that the discomposure of cards doesn't lead the card not a straight. We adjust them and can be straight. That means 5S 2S 4S AS 3S is also a straight flush? b/c we can adjust them like AS 2S 3S 4S 5S
8th Aug 2024, 5:31 AM
0
Wong Hei Ming ace can be low or high card when it comes first it can be low and high if it comes in the last . I rewritten my code to pass 10S JS QS KS 9S as a straight flush, but test cases #5 and #6 can't pass again. you can see it in my code the straight function .
8th Aug 2024, 7:16 AM