1
1
This commit is contained in:
@@ -42,6 +42,21 @@ class ChengduMahjongState:
|
||||
raise ValueError("缺门设置无效")
|
||||
self.missing_suits[player] = missing_suit
|
||||
|
||||
def print_game_state(self, player_index: int):
|
||||
"""
|
||||
打印指定玩家的手牌、暗牌、明牌和缺门信息。
|
||||
|
||||
:param player_index: 要打印的玩家索引(0-3)。
|
||||
"""
|
||||
hand = self.hands[player_index]
|
||||
melds = self.melds[player_index]
|
||||
missing_suit = self.missing_suits[player_index]
|
||||
|
||||
# 打印日志,所有信息在一行
|
||||
logger.info(
|
||||
f"玩家索引: {player_index}, 手牌: {hand}, 明牌: {melds}, 总牌数: {len(hand.tiles) + sum(meld.count for meld in melds)}, 缺门: {missing_suit}"
|
||||
)
|
||||
|
||||
def can_win(self, hand: Hand, melds: list[Meld], missing_suit: str):
|
||||
"""
|
||||
判断玩家是否能胡牌。
|
||||
|
||||
Reference in New Issue
Block a user