def __init__(self, tiles, dora_indicators, revealed_tiles): self.tiles = tiles self.Shanten_calculater = Shanten() self.Hand_Calculator = HandCalculator() self.Tiles = TilesConverter() self.shanten = self.Shanten_calculater.calculate_shanten( self.Tiles.to_34_array(self.tiles)) self.Hand_Config = HandConfig(is_riichi=True) self.dora_indicators = dora_indicators self.revealed_tiles = revealed_tiles
def draw_tile(self, tile): """ :param tile: 136 tile format :return: """ self.player.in_tempai = False self.shanten_calculator = Shanten() Tile = TilesConverter() current_shanten = self.shanten_calculator.calculate_shanten( Tile.to_34_array(self.player.tiles)) logger.debug('Current_shanten:{}'.format(current_shanten)) if current_shanten == 0: self.player.in_tempai = True logger.debug('whether_in_tempai:{}'.format(self.player.in_tempai)) self.shanten_calculator = None
from mahjong.tile import TilesConverter from mahjong.hand_calculating.hand import HandCalculator hc = HandCalculator() tc = TilesConverter() tiles = tc.string_to_136_array('22444', '333567', '444') result = hc.estimate_hand_value(tiles, tiles[0], None, None, None) print(result)
from mahjong.shanten import Shanten from mahjong.hand_calculating.hand import HandCalculator from mahjong.tile import TilesConverter from mahjong.hand_calculating.hand_config import HandConfig from mahjong.meld import Meld import math t = [108, 108, 112, 113, 116, 117, 120, 121, 124, 125, 128, 129, 132] Shanten = Shanten() Form = TilesConverter() #result=Form.to_one_line_string(t) #print (result) print(Shanten.calculate_shanten(Form.to_34_array(t), None, False, False))