parent
fc1259d0e2
commit
840d44b773
|
|
@ -72,7 +72,6 @@ class ChengduMahjongEngine:
|
||||||
|
|
||||||
# AI 决策是否杠牌
|
# AI 决策是否杠牌
|
||||||
if should_gang(current_player, self.state, gang_type):
|
if should_gang(current_player, self.state, gang_type):
|
||||||
self.state.hands[current_player].perform_gang() # 执行杠操作
|
|
||||||
self.state.print_game_state(current_player)
|
self.state.print_game_state(current_player)
|
||||||
|
|
||||||
# 计算杠牌得分
|
# 计算杠牌得分
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,10 @@ class Hand:
|
||||||
""" 向手牌中添加一张牌 """
|
""" 向手牌中添加一张牌 """
|
||||||
if not isinstance(tile, MahjongTile):
|
if not isinstance(tile, MahjongTile):
|
||||||
raise ValueError("必须添加 MahjongTile 类型的牌")
|
raise ValueError("必须添加 MahjongTile 类型的牌")
|
||||||
|
if len(self.tiles) >= 14:
|
||||||
|
raise ValueError("手牌数量不能超过 14 张")
|
||||||
self.tiles.append(tile) # 将牌添加到手牌中
|
self.tiles.append(tile) # 将牌添加到手牌中
|
||||||
self.tile_count[tile] += 1 # 增加牌的数量
|
self.tile_count[tile] += 1 # 增加牌的数量
|
||||||
|
|
||||||
def remove_tile(self, tile):
|
def remove_tile(self, tile):
|
||||||
""" 从手牌中移除一张牌 """
|
""" 从手牌中移除一张牌 """
|
||||||
if not isinstance(tile, MahjongTile):
|
if not isinstance(tile, MahjongTile):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue