This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
from mahjong.ai.agari import Agari | ||
|
||
|
||
class FinishedHand(object): | ||
|
||
@classmethod | ||
def estimate_hand_value(cls, tiles, is_tsumo, is_riichi, is_open_hand): | ||
# not implemented yet | ||
def estimate_hand_value(cls, tiles, win_tile, is_tsumo, is_riichi, is_dealer, is_open_hand): | ||
""" | ||
:param tiles: array with 13 tiles in 136-tile format | ||
:param win_tile: tile that caused win (ron or tsumo) | ||
:return: The dictionary with hand cost or error response | ||
{"cost": 1000, "han": 1, "fu": 30, "error": None} | ||
{"cost": None, "han": 0, "fu": 0, "error": "Hand is not valid"} | ||
""" | ||
agari = Agari() | ||
cost = None | ||
error = None | ||
|
||
hand_yaku = [] | ||
han = 0 | ||
fu = 0 | ||
|
||
def return_response(): | ||
return {'cost': cost, 'error': error, 'han': han, 'fu': fu} | ||
|
||
# total_tiles = list(tiles) + [win_tile] | ||
# if not agari.is_agari(total_tiles): | ||
# error = 'Hand is not winning' | ||
# return return_response() | ||
|
||
if han == 1 and fu < 30: | ||
error = 'Not valid han and fu' | ||
return return_response() | ||
|
||
return 1000 |