| 254 | return len(self._card_suit) == 1 |
| 255 | |
| 256 | def _is_five_high_straight(self) -> bool: |
| 257 | # If a card is a five high straight (low ace) change the location of |
| 258 | # ace from the start of the list to the end. Check whether the first |
| 259 | # element is ace or not. (Don't want to change again) |
| 260 | # Five high straight (low ace): AH 2H 3S 4C 5D |
| 261 | # Why use sorted here? One call to this function will mutate the list to |
| 262 | # [5, 4, 3, 2, 14] and so for subsequent calls (which will be rare) we |
| 263 | # need to compare the sorted version. |
| 264 | # Refer test_multiple_calls_five_high_straight in test_poker_hand.py |
| 265 | if sorted(self._card_values) == [2, 3, 4, 5, 14]: |
| 266 | if self._card_values[0] == 14: |
| 267 | # Remember, our list is sorted in reverse order |
| 268 | ace_card = self._card_values.pop(0) |
| 269 | self._card_values.append(ace_card) |
| 270 | return True |
| 271 | return False |
| 272 | |
| 273 | def _is_straight(self) -> bool: |
| 274 | for i in range(4): |