Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit dc9195c

Browse files
committed
Don't count dead waits for hand value estimation
1 parent 6234387 commit dc9195c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

project/game/ai/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def estimate_hand_value(self, win_tile, tiles=None, call_riichi=False, is_tsumo=
205205

206206
def estimate_weighted_mean_hand_value(self, discard_option):
207207
weighted_hand_cost = 0
208+
number_of_tiles = 0
208209
for waiting in discard_option.waiting:
209210
tiles = copy.copy(self.player.tiles)
210211
tiles.remove(discard_option.find_tile_in_hand(self.player.closed_hand))
@@ -217,8 +218,9 @@ def estimate_weighted_mean_hand_value(self, discard_option):
217218
continue
218219

219220
weighted_hand_cost += hand_cost.cost["main"] * discard_option.wait_to_ukeire[waiting]
221+
number_of_tiles += discard_option.wait_to_ukeire[waiting]
220222

221-
return int(weighted_hand_cost / discard_option.ukeire)
223+
return int(weighted_hand_cost / number_of_tiles)
222224

223225
def should_call_riichi(self):
224226
return self.riichi.should_call_riichi()

0 commit comments

Comments
 (0)