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


Python Table.get_player方法代码示例

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


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

示例1: test_detect_enemy_tempai_and_riichi

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import get_player [as 别名]
    def test_detect_enemy_tempai_and_riichi(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_riichi(1)

        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,代码行数:12,代码来源:tests_enemy_analyzer.py

示例2: test_set_scores

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import get_player [as 别名]
    def test_set_scores(self):
        table = Table()
        table.init_round(0, 0, 0, 0, 0, [])
        scores = [230, 110, 55, 405]

        table.set_players_scores(scores)

        self.assertEqual(table.get_player(0).scores, 23000)
        self.assertEqual(table.get_player(1).scores, 11000)
        self.assertEqual(table.get_player(2).scores, 5500)
        self.assertEqual(table.get_player(3).scores, 40500)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:13,代码来源:tests_table.py

示例3: test_temporary_safe_tiles

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

        table.add_discarded_tile(1, self._string_to_136_tile(man='4'), False)

        self.assertEqual(table.get_player(1).temporary_safe_tiles, [])
        self.assertEqual(table.get_player(2).temporary_safe_tiles, [3])
        self.assertEqual(table.get_player(3).temporary_safe_tiles, [3])

        table.add_discarded_tile(2, self._string_to_136_tile(man='5'), False)

        self.assertEqual(table.get_player(1).temporary_safe_tiles, [4])
        self.assertEqual(table.get_player(2).temporary_safe_tiles, [])
        self.assertEqual(table.get_player(3).temporary_safe_tiles, [3, 4])

        table.add_discarded_tile(3, self._string_to_136_tile(man='6'), False)

        self.assertEqual(table.get_player(1).temporary_safe_tiles, [4, 5])
        self.assertEqual(table.get_player(2).temporary_safe_tiles, [5])
        self.assertEqual(table.get_player(3).temporary_safe_tiles, [])

        table.add_discarded_tile(1, self._string_to_136_tile(man='7'), False)

        self.assertEqual(table.get_player(1).temporary_safe_tiles, [])
        self.assertEqual(table.get_player(2).temporary_safe_tiles, [5, 6])
        self.assertEqual(table.get_player(3).temporary_safe_tiles, [6])
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:28,代码来源:tests_defence.py

示例4: test_set_scores_and_uma

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import get_player [as 别名]
    def test_set_scores_and_uma(self):
        table = Table()
        table.init_round(0, 0, 0, 0, 0, [])
        scores = [230, 110, 55, 405]
        uma = [-17, 3, 48, -34]

        table.set_players_scores(scores, uma)

        self.assertEqual(table.get_player(0).scores, 23000)
        self.assertEqual(table.get_player(0).uma, -17)
        self.assertEqual(table.get_player(1).scores, 11000)
        self.assertEqual(table.get_player(1).uma, 3)
        self.assertEqual(table.get_player(2).scores, 5500)
        self.assertEqual(table.get_player(2).uma, 48)
        self.assertEqual(table.get_player(3).scores, 40500)
        self.assertEqual(table.get_player(3).uma, -34)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:18,代码来源:tests_table.py

示例5: test_find_dealer_tile_to_discard

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import get_player [as 别名]
    def test_find_dealer_tile_to_discard(self):
        dealer = 2
        dora = self._string_to_136_tile(honors='3')
        table = Table()
        table.init_round(0, 0, 0, dora, dealer, [])

        tiles = self._string_to_136_array(sou='2234678', pin='34', man='45789')
        table.player.init_hand(tiles)

        table.add_discarded_tile(1, self._string_to_136_tile(man='4'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(man='5'), False)

        table.add_discarded_tile(2, self._string_to_136_tile(man='8'), False)
        table.add_discarded_tile(2, self._string_to_136_tile(man='9'), False)

        table.add_called_riichi(1)
        table.add_called_riichi(2)

        # for this test we don't need temporary_safe_tiles
        table.get_player(1).temporary_safe_tiles = []
        table.get_player(2).temporary_safe_tiles = []

        result = table.player.discard_tile()
        # second player is a dealer, let's fold against him
        self.assertEqual(self._to_string([result]), '9m')

        tiles = self._string_to_136_array(sou='234567', pin='348', man='234', honors='23')
        table.player.init_hand(tiles)

        result = table.player.discard_tile()
        # there is no safe tiles against dealer, so let's fold against other players
        self.assertEqual(table.player.ai.in_defence, True)
        self.assertEqual(self._to_string([result]), '4m')
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:35,代码来源:tests_defence.py

示例6: test_set_names_and_ranks

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

        values = [
            {'name': 'NoName', 'rank': u'新人'},
            {'name': 'o2o2', 'rank': u'3級'},
            {'name': 'shimmmmm', 'rank': u'三段'},
            {'name': u'川海老', 'rank': u'9級'}
        ]

        table.set_players_names_and_ranks(values)

        self.assertEqual(table.get_player(0).name, 'NoName')
        self.assertEqual(table.get_player(0).rank, u'新人')
        self.assertEqual(table.get_player(3).name, u'川海老')
        self.assertEqual(table.get_player(3).rank, u'9級')
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:19,代码来源:tests_table.py

示例7: test_add_safe_tile_after_discard

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

        table.add_discarded_tile(1, self._string_to_136_tile(man='3'), False)
        table.add_discarded_tile(0, self._string_to_136_tile(man='4'), False)

        self.assertEqual(len(table.get_player(1).discards), 1)
        self.assertEqual(len(table.get_player(2).discards), 0)
        self.assertEqual(len(table.get_player(3).discards), 0)

        self.assertEqual(len(table.get_player(1).safe_tiles), 1)
        self.assertEqual(len(table.get_player(2).safe_tiles), 0)
        self.assertEqual(len(table.get_player(3).safe_tiles), 2)

        # "2" is 3 man
        self.assertEqual(table.get_player(1).safe_tiles, [2])
        self.assertEqual(table.get_player(3).safe_tiles, [2, 3])
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:20,代码来源:tests_defence.py

示例8: test_init_round

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

        round_wind_number = 4
        count_of_honba_sticks = 2
        count_of_riichi_sticks = 3
        dora_indicator = 126
        dealer = 3
        scores = [250, 250, 250, 250]

        table.init_round(
            round_wind_number,
            count_of_honba_sticks,
            count_of_riichi_sticks,
            dora_indicator,
            dealer,
            scores
        )

        self.assertEqual(table.round_wind_number, round_wind_number)
        self.assertEqual(table.count_of_honba_sticks, count_of_honba_sticks)
        self.assertEqual(table.count_of_riichi_sticks, count_of_riichi_sticks)
        self.assertEqual(table.dora_indicators[0], dora_indicator)
        self.assertEqual(table.get_player(dealer).is_dealer, True)
        self.assertEqual(table.get_player(dealer).scores, 25000)

        dealer = 2
        table.player.in_tempai = True
        table.player.in_riichi = True
        table.init_round(
            round_wind_number,
            count_of_honba_sticks,
            count_of_riichi_sticks,
            dora_indicator,
            dealer,
            scores
        )

        # test that we reinit round properly
        self.assertEqual(table.get_player(3).is_dealer, False)
        self.assertEqual(table.player.in_tempai, False)
        self.assertEqual(table.player.in_riichi, False)
        self.assertEqual(table.get_player(dealer).is_dealer, True)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:45,代码来源:tests_table.py

示例9: test_detect_enemy_tempai_and_opened_sets

# 需要导入模块: from game.table import Table [as 别名]
# 或者: from game.table.Table import get_player [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

示例10: test_try_to_detect_honitsu_hand

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

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

        table.add_discarded_tile(1, self._string_to_136_tile(sou='1'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(sou='5'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(sou='8'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(sou='9'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(man='1'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(man='1'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(pin='1'), False)

        self.assertEqual(EnemyAnalyzer(table.get_player(1)).is_threatening, True)
        self.assertEqual(EnemyAnalyzer(table.get_player(1)).chosen_suit, is_pin)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:19,代码来源:tests_enemy_analyzer.py

示例11: test_find_common_safe_tile_to_discard

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

        tiles = self._string_to_136_array(sou='2456', pin='234478', man='2336')
        table.player.init_hand(tiles)

        table.add_discarded_tile(1, self._string_to_136_tile(sou='6'), False)
        table.add_discarded_tile(1, self._string_to_136_tile(pin='5'), False)

        table.add_discarded_tile(2, self._string_to_136_tile(pin='5'), False)
        table.add_discarded_tile(2, self._string_to_136_tile(sou='6'), False)

        table.add_called_riichi(1)
        table.add_called_riichi(2)

        # for this test we don't need temporary_safe_tiles
        table.get_player(1).temporary_safe_tiles = []
        table.get_player(2).temporary_safe_tiles = []

        result = table.player.discard_tile()

        self.assertEqual(self._to_string([result]), '6s')
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:24,代码来源:tests_defence.py

示例12: test_set_scores_and_recalculate_player_position

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

        self.assertEqual(table.get_player(0).first_seat, 0)
        self.assertEqual(table.get_player(1).first_seat, 1)
        self.assertEqual(table.get_player(2).first_seat, 2)
        self.assertEqual(table.get_player(3).first_seat, 3)

        scores = [230, 110, 55, 405]
        table.set_players_scores(scores)

        self.assertEqual(table.get_player(0).position, 2)
        self.assertEqual(table.get_player(1).position, 3)
        self.assertEqual(table.get_player(2).position, 4)
        self.assertEqual(table.get_player(3).position, 1)

        scores = [110, 110, 405, 405]
        table.set_players_scores(scores)

        self.assertEqual(table.get_player(0).position, 3)
        self.assertEqual(table.get_player(1).position, 4)
        self.assertEqual(table.get_player(2).position, 1)
        self.assertEqual(table.get_player(3).position, 2)
开发者ID:MahjongRepository,项目名称:tenhou-python-bot,代码行数:26,代码来源:tests_table.py


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