本文整理汇总了Python中game.table.Table.add_dora_indicator方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_dora_indicator方法的具体用法?Python Table.add_dora_indicator怎么用?Python Table.add_dora_indicator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.table.Table
的用法示例。
在下文中一共展示了Table.add_dora_indicator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_atodzuke_dont_open_no_yaku_tempai
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_atodzuke_dont_open_no_yaku_tempai(self):
# make sure yakuhai strategy is activated by adding 3 doras to the hand
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='9'))
tiles = self._string_to_136_array(man='111445', sou='567', pin='56', honors='77')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, man='111')
player.add_called_meld(meld)
# 6 man is bad meld, we lose our second pair and so is 4 man
tile = self._string_to_136_tile(man='6')
meld, _ = player.try_to_call_meld(tile, True)
self.assertEqual(meld, None)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
tile = self._string_to_136_tile(man='4')
meld, _ = player.try_to_call_meld(tile, True)
self.assertEqual(meld, None)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
# 7 pin is a good meld, we get to tempai keeping yakuhai wait
tile = self._string_to_136_tile(pin='7')
meld, _ = player.try_to_call_meld(tile, True)
self.assertNotEqual(meld, None)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
示例2: test_discard_tile_and_wrong_tiles_valuation
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_discard_tile_and_wrong_tiles_valuation(self):
"""
Bot wanted to discard 5m from the first hand,
because valuation for 2p was miscalculated (too high)
Same issue with wrong valuation was with second hand
"""
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(honors='2'))
tiles = self._string_to_136_array(man='445567', pin='245678', sou='67')
player.init_hand(tiles)
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '2p')
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='5'))
tiles = self._string_to_136_array(man='45667', pin='34677', sou='38', honors='22')
player.init_hand(tiles)
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '8s')
示例3: test_choose_better_tanki_honor
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_choose_better_tanki_honor(self):
table = Table()
player = table.player
player.round_step = 2
player.dealer_seat = 3
table.add_dora_indicator(self._string_to_136_tile(man='8'))
tiles = self._string_to_136_array(man='11447799', sou='556', honors='45')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(honors='4'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '6s')
tiles = self._string_to_136_array(man='11447799', sou='556', honors='45')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(honors='5'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '6s')
tiles = self._string_to_136_array(man='11447799', sou='556', honors='45')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(sou='6'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '5z')
tiles = self._string_to_136_array(man='11447799', sou='556', honors='34')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(sou='6'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '3z')
示例4: test_discard_tile_with_better_wait_in_iishanten
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_discard_tile_with_better_wait_in_iishanten(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(sou='4'))
tiles = self._string_to_136_array(man='123567', pin='113788', sou='99')
player.init_hand(tiles)
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '8p')
示例5: test_discard_tile_with_max_ukeire_second_level
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_discard_tile_with_max_ukeire_second_level(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(sou='4'))
tiles = self._string_to_136_array(sou='11367', pin='45', man='344778')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(pin='6'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '3s')
示例6: test_prefer_valuable_tiles_with_almost_same_ukeire
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_prefer_valuable_tiles_with_almost_same_ukeire(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(sou='4'))
tiles = self._string_to_136_array(sou='1366', pin='123456', man='345')
player.init_hand(tiles)
player.draw_tile(self._string_to_136_tile(sou='5'))
discarded_tile = player.discard_tile()
self.assertEqual(self._to_string([discarded_tile]), '1s')
示例7: test_calculate_second_level_ukeire
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_calculate_second_level_ukeire(self):
"""
There was a bug with 2356 form and second level ukeire
"""
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='2'))
table.add_discarded_tile(1, self._string_to_136_tile(man='2'), False)
table.add_discarded_tile(1, self._string_to_136_tile(pin='3'), False)
table.add_discarded_tile(1, self._string_to_136_tile(pin='3'), False)
tiles = self._string_to_136_array(man='34678', pin='2356', sou='4467')
tile = self._string_to_136_tile(sou='8')
player.init_hand(tiles)
player.draw_tile(tile)
discard_options, _ = player.ai.hand_builder.find_discard_options(
player.tiles,
player.closed_hand,
player.melds
)
tile = self._string_to_136_tile(man='4')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 108)
tile = self._string_to_136_tile(man='3')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 108)
tile = self._string_to_136_tile(pin='2')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 96)
tile = self._string_to_136_tile(pin='3')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 96)
tile = self._string_to_136_tile(pin='5')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 96)
tile = self._string_to_136_tile(pin='6')
discard_option = [x for x in discard_options if x.tile_to_discard == tile // 4][0]
player.ai.hand_builder.calculate_second_level_ukeire(discard_option, player.tiles, player.melds)
self.assertEqual(discard_option.ukeire_second, 96)
示例8: test_open_hand_when_yakuhai_already_in_the_hand
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_open_hand_when_yakuhai_already_in_the_hand(self):
# make sure yakuhai strategy is activated by adding 3 doras to the hand
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(honors='5'))
tiles = self._string_to_136_array(man='46', pin='4679', sou='1348', honors='666')
player.init_hand(tiles)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
tile = self._string_to_136_tile(sou='2')
meld, _ = player.try_to_call_meld(tile, True)
self.assertNotEqual(meld, None)
示例9: test_mark_dora_as_dangerous_tile_for_suji
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_mark_dora_as_dangerous_tile_for_suji(self):
table = Table()
table.add_dora_indicator(self._string_to_136_tile(man='8'))
tiles = self._string_to_136_array(man='112235', pin='4557788')
table.player.init_hand(tiles)
# 9 man is dora!
table.player.draw_tile(self._string_to_136_tile(man='9'))
table.add_discarded_tile(1, self._string_to_136_tile(man='6'), False)
table.add_called_riichi(1)
result = table.player.discard_tile()
self.assertEqual(self._to_string([result]), '3m')
示例10: test_discard_tile_based_on_second_level_ukeire_and_cost
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_discard_tile_based_on_second_level_ukeire_and_cost(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='2'))
table.add_discarded_tile(1, self._string_to_136_tile(man='2'), False)
tiles = self._string_to_136_array(man='34678', pin='2356', sou='4467')
tile = self._string_to_136_tile(sou='8')
player.init_hand(tiles)
player.draw_tile(tile)
discarded_tile = player.discard_tile()
discard_correct = self._to_string([discarded_tile]) == '2p' or self._to_string([discarded_tile]) == '3p'
self.assertEqual(discard_correct, True)
示例11: test_choose_1_shanten_with_cost_possibility_draw
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_choose_1_shanten_with_cost_possibility_draw(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(sou='4'))
tiles = self._string_to_136_array(man='557', pin='468', sou='55577', honors='66')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, sou='555')
player.add_called_meld(meld)
tile = self._string_to_136_tile(sou='7')
player.draw_tile(tile)
discarded_tile = player.discard_tile()
self.assertNotEqual(player.ai.current_strategy, None)
self.assertEqual(player.ai.current_strategy.type, BaseStrategy.YAKUHAI)
self.assertEqual(self._to_string([discarded_tile]), '7m')
示例12: test_5_pairs_yakuhai_not_chiitoitsu
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_5_pairs_yakuhai_not_chiitoitsu(self):
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(sou='9'))
table.add_dora_indicator(self._string_to_136_tile(sou='1'))
tiles = self._string_to_136_array(sou='112233', pin='16678', honors='66')
player.init_hand(tiles)
tile = self._string_to_136_tile(honors='6')
meld, _ = player.try_to_call_meld(tile, True)
self.assertNotEqual(player.ai.current_strategy.type, BaseStrategy.CHIITOITSU)
self.assertEqual(player.ai.current_strategy.type, BaseStrategy.YAKUHAI)
self.assertNotEqual(meld, None)
示例13: test_keep_only_yakuhai_pon
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_keep_only_yakuhai_pon(self):
# make sure yakuhai strategy is activated by adding 3 doras to the hand
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='9'))
table.add_dora_indicator(self._string_to_136_tile(man='3'))
tiles = self._string_to_136_array(man='11144', sou='567', pin='56', honors='777')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, man='111')
player.add_called_meld(meld)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
player.draw_tile(self._string_to_136_tile(man='4'))
discarded_tile = player.discard_tile()
self.assertNotEqual(self._to_string([discarded_tile]), '7z')
示例14: test_atodzuke_dont_destroy_second_pair
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_atodzuke_dont_destroy_second_pair(self):
# make sure yakuhai strategy is activated by adding 3 doras to the hand
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='9'))
tiles = self._string_to_136_array(man='111445', sou='468', pin='56', honors='77')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, man='111')
player.add_called_meld(meld)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
# 6 man is bad meld, we lose our second pair and so is 4 man
tile = self._string_to_136_tile(man='6')
meld, _ = player.try_to_call_meld(tile, True)
self.assertEqual(meld, None)
tile = self._string_to_136_tile(man='4')
meld, _ = player.try_to_call_meld(tile, True)
self.assertEqual(meld, None)
# but if we have backup pair it's ok
tiles = self._string_to_136_array(man='111445', sou='468', pin='88', honors='77')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, man='111')
player.add_called_meld(meld)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
# 6 man is bad meld, we lose our second pair and so is 4 man
tile = self._string_to_136_tile(man='6')
meld, _ = player.try_to_call_meld(tile, True)
self.assertNotEqual(meld, None)
tile = self._string_to_136_tile(man='4')
meld, _ = player.try_to_call_meld(tile, True)
self.assertNotEqual(meld, None)
示例15: test_atodzuke_choose_hidden_syanpon
# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import add_dora_indicator [as 别名]
def test_atodzuke_choose_hidden_syanpon(self):
# make sure yakuhai strategy is activated by adding 3 doras to the hand
table = Table()
player = table.player
table.add_dora_indicator(self._string_to_136_tile(man='9'))
tiles = self._string_to_136_array(man='111678', sou='56678', honors='77')
player.init_hand(tiles)
meld = self._make_meld(Meld.PON, man='111')
player.add_called_meld(meld)
strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player)
self.assertEqual(strategy.should_activate_strategy(player.tiles), True)
for _ in range(0, 4):
table.add_discarded_tile(1, self._string_to_136_tile(sou='9'), False)
player.draw_tile(self._string_to_136_tile(man='6'))
discarded_tile = player.discard_tile()
self.assertNotEqual(self._to_string([discarded_tile]), '6m')