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

Commit 3ca75a1

Browse files
committed
Upgrade mahjong lib to the 1.1.0 version
1 parent 551f982 commit 3ca75a1

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

project/game/ai/first_version/main.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from mahjong.constants import AKA_DORA_LIST, CHUN, HAKU, HATSU
66
from mahjong.hand_calculating.divider import HandDivider
77
from mahjong.hand_calculating.hand import HandCalculator
8+
from mahjong.hand_calculating.hand_config import HandConfig
89
from mahjong.meld import Meld
910
from mahjong.shanten import Shanten
1011
from mahjong.tile import TilesConverter
@@ -285,6 +286,7 @@ def estimate_hand_value(self, win_tile, tiles=None, call_riichi=False):
285286
:return:
286287
"""
287288
win_tile *= 4
289+
288290
# we don't need to think, that our waiting is aka dora
289291
if win_tile in AKA_DORA_LIST:
290292
win_tile += 1
@@ -293,17 +295,20 @@ def estimate_hand_value(self, win_tile, tiles=None, call_riichi=False):
293295
tiles = self.player.tiles
294296

295297
tiles += [win_tile]
296-
result = self.finished_hand.estimate_hand_value(tiles=tiles,
297-
win_tile=win_tile,
298-
is_tsumo=False,
299-
is_riichi=call_riichi,
300-
is_dealer=self.player.is_dealer,
301-
melds=self.player.melds,
302-
player_wind=self.player.player_wind,
303-
round_wind=self.player.table.round_wind,
304-
dora_indicators=self.player.table.dora_indicators,
305-
has_aka_dora=self.player.table.has_aka_dora,
306-
has_open_tanyao=self.player.table.has_open_tanyao)
298+
299+
config = HandConfig(
300+
is_riichi=call_riichi,
301+
player_wind=self.player.player_wind,
302+
round_wind=self.player.table.round_wind,
303+
has_aka_dora=self.player.table.has_aka_dora,
304+
has_open_tanyao=self.player.table.has_open_tanyao
305+
)
306+
307+
result = self.finished_hand.estimate_hand_value(tiles,
308+
win_tile,
309+
self.player.melds,
310+
self.player.table.dora_indicators,
311+
config)
307312
return result
308313

309314
def should_call_riichi(self):
@@ -326,7 +331,7 @@ def should_call_riichi(self):
326331

327332
tiles_34 = TilesConverter.to_34_array(tiles)
328333

329-
results = self.hand_divider.divide_hand(tiles_34, [], [])
334+
results = self.hand_divider.divide_hand(tiles_34)
330335
result = results[0]
331336

332337
count_of_pairs = len([x for x in result if is_pair(x)])

project/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
mahjong==1.0.5
1+
mahjong==1.1.0
22
requests==2.18.4
33
flake8==3.4.1

0 commit comments

Comments
 (0)