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

Commit a79671f

Browse files
committed
Improve honitsu discard detection
1 parent 3e6a296 commit a79671f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

project/mahjong/ai/defence/enemy_analyzer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def _is_honitsu_discards(self, discards_34):
104104

105105
result = count_tiles_by_suits(discards_34)
106106

107+
honors = [x for x in result if x['name'] == 'honor'][0]
107108
suits = [x for x in result if x['name'] != 'honor']
108109
suits = sorted(suits, key=lambda x: x['count'], reverse=False)
109110

@@ -112,7 +113,7 @@ def _is_honitsu_discards(self, discards_34):
112113

113114
# there is not too much one suit + honor tiles in the discard
114115
# so we can tell that user trying to collect honitsu
115-
if percentage_of_less_suit <= 20:
116+
if percentage_of_less_suit <= 20 and honors['count'] < 3:
116117
return True, suits[0]['function']
117118

118119
return False, None

0 commit comments

Comments
 (0)