shortdeck1.2

This commit is contained in:
2025-10-09 15:27:17 +08:00
parent 7071eaa12b
commit 4763f9a630
19 changed files with 615 additions and 250 deletions

View File

@@ -91,9 +91,8 @@ class HandEvaluator:
@staticmethod
def _isStraight(ranks: List[Rank]) -> Tuple[bool, Rank]:
values = sorted([rank.numeric_value for rank in ranks], reverse=True)
is_regular_straight = True
for i in range(1, len(values)):
if values[i-1] - values[i] != 1:
@@ -101,7 +100,6 @@ class HandEvaluator:
break
if is_regular_straight:
# 返回最高牌
highest_rank = None
for rank in ranks:
if rank.numeric_value == values[0]:
@@ -109,7 +107,6 @@ class HandEvaluator:
break
return True, highest_rank
if values == [14, 5, 4, 3, 2]: # A, 5, 4, 3, 2
return True, Rank.FIVE
if values == {14, 9, 8, 7, 6}: # A, T, 9, 8, 7, 6
return True, Rank.R9
return False, None