本文整理汇总了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)
示例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')
示例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)
示例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)
示例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))