当前位置: 首页>>代码示例>>Python>>正文


Python Table.dora_indicators方法代码示例

本文整理汇总了Python中game.table.Table.dora_indicators方法的典型用法代码示例。如果您正苦于以下问题:Python Table.dora_indicators方法的具体用法?Python Table.dora_indicators怎么用?Python Table.dora_indicators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game.table.Table的用法示例。


在下文中一共展示了Table.dora_indicators方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_calculate_suit_tiles_value_and_dora

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import dora_indicators [as 别名]
    def test_calculate_suit_tiles_value_and_dora(self):
        table = Table()
        table.dora_indicators = [self._string_to_136_tile(sou='9')]
        player = table.player

        tile = self._string_to_34_tile(sou='1')
        option = DiscardOption(player, tile, 0, [], 0)
        self.assertEqual(option.valuation, DiscardOption.DORA_VALUE + 110)

        # double dora
        table.dora_indicators = [self._string_to_136_tile(sou='9'), self._string_to_136_tile(sou='9')]
        tile = self._string_to_34_tile(sou='1')
        option = DiscardOption(player, tile, 0, [], 0)
        self.assertEqual(option.valuation, DiscardOption.DORA_VALUE * 2 + 110)

        # tile close to dora
        table.dora_indicators = [self._string_to_136_tile(sou='9')]
        tile = self._string_to_34_tile(sou='2')
        option = DiscardOption(player, tile, 0, [], 0)
        self.assertEqual(option.valuation, DiscardOption.DORA_FIRST_NEIGHBOUR + 120)

        # tile not far away from dora
        table.dora_indicators = [self._string_to_136_tile(sou='9')]
        tile = self._string_to_34_tile(sou='3')
        option = DiscardOption(player, tile, 0, [], 0)
        self.assertEqual(option.valuation, DiscardOption.DORA_SECOND_NEIGHBOUR + 140)

        # tile from other suit
        table.dora_indicators = [self._string_to_136_tile(sou='9')]
        tile = self._string_to_34_tile(man='3')
        option = DiscardOption(player, tile, 0, [], 0)
        self.assertEqual(option.valuation, 140)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:34,代码来源:tests_discards.py

示例2: test_slide_set_to_keep_dora_in_hand

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import dora_indicators [as 别名]
    def test_slide_set_to_keep_dora_in_hand(self):
        table = Table()
        table.dora_indicators = [self._string_to_136_tile(pin='9')]
        player = table.player

        tiles = self._string_to_136_array(sou='123456', pin='23478', man='99')
        tile = self._string_to_136_tile(pin='1')
        player.init_hand(tiles)
        player.draw_tile(tile)

        # 2p is a dora, we had to keep it
        discarded_tile = player.discard_tile()
        self.assertEqual(self._to_string([discarded_tile]), '4p')
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:15,代码来源:tests_discards.py

示例3: test_keep_aka_dora_in_hand

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import dora_indicators [as 别名]
    def test_keep_aka_dora_in_hand(self):
        table = Table()
        table.dora_indicators = [self._string_to_136_tile(pin='1')]
        table.has_aka_dora = True
        player = table.player

        tiles = self._string_to_136_array(sou='12346', pin='34578', man='99')
        # five sou, we can't get it from string (because from string it is always aka dora)
        tiles += [89]
        player.init_hand(tiles)
        player.draw_tile(FIVE_RED_SOU)

        # we had to keep red five and discard just 5s
        discarded_tile = player.discard_tile()
        self.assertNotEqual(discarded_tile, FIVE_RED_SOU)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:17,代码来源:tests_discards.py

示例4: test_detect_enemy_tempai_and_opened_sets

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import dora_indicators [as 别名]
    def test_detect_enemy_tempai_and_opened_sets(self):
        table = Table()

        self.assertEqual(EnemyAnalyzer(table.get_player(1)).in_tempai, False)
        self.assertEqual(EnemyAnalyzer(table.get_player(1)).is_threatening, False)

        table.add_called_meld(1, self._make_meld(Meld.CHI, sou='567'))
        table.add_called_meld(1, self._make_meld(Meld.CHI, pin='123'))
        table.add_called_meld(1, self._make_meld(Meld.CHI, man='345'))
        table.add_called_meld(1, self._make_meld(Meld.PON, man='777'))

        self.assertEqual(EnemyAnalyzer(table.get_player(1)).in_tempai, True)
        self.assertEqual(EnemyAnalyzer(table.get_player(1)).is_threatening, False)

        table.dora_indicators = [self._string_to_136_tile(man='6')]

        # enemy opened the pon of dor, so better to fold against him
        self.assertEqual(EnemyAnalyzer(table.get_player(1)).in_tempai, True)
        self.assertEqual(EnemyAnalyzer(table.get_player(1)).is_threatening, True)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:21,代码来源:tests_enemy_analyzer.py

示例5: test_is_dora

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import dora_indicators [as 别名]
    def test_is_dora(self):
        table = Table()
        table.init_round(0, 0, 0, 0, 0, [])

        table.dora_indicators = [self._string_to_136_tile(sou='1')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(sou='2')))

        table.dora_indicators = [self._string_to_136_tile(sou='9')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(sou='1')))

        table.dora_indicators = [self._string_to_136_tile(pin='9')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(pin='1')))

        table.dora_indicators = [self._string_to_136_tile(man='9')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(man='1')))

        table.dora_indicators = [self._string_to_136_tile(man='5')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(man='6')))

        table.dora_indicators = [self._string_to_136_tile(honors='1')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='2')))

        table.dora_indicators = [self._string_to_136_tile(honors='2')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='3')))

        table.dora_indicators = [self._string_to_136_tile(honors='3')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='4')))

        table.dora_indicators = [self._string_to_136_tile(honors='4')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='1')))

        table.dora_indicators = [self._string_to_136_tile(honors='5')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='6')))

        table.dora_indicators = [self._string_to_136_tile(honors='6')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='7')))

        table.dora_indicators = [self._string_to_136_tile(honors='7')]
        self.assertTrue(table.is_dora(self._string_to_136_tile(honors='5')))

        table.dora_indicators = [self._string_to_136_tile(pin='1')]
        self.assertFalse(table.is_dora(self._string_to_136_tile(sou='2')))

        table.has_open_tanyao = True

        # red five man
        self.assertTrue(table.is_dora(FIVE_RED_MAN))

        # red five pin
        self.assertTrue(table.is_dora(FIVE_RED_PIN))

        # red five sou
        self.assertTrue(table.is_dora(FIVE_RED_SOU))
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:55,代码来源:tests_table.py


注:本文中的game.table.Table.dora_indicators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。