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


Python CallHistory.empty_for_board_number方法代码示例

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


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

示例1: from_identifier

# 需要导入模块: from core.callhistory import CallHistory [as 别名]
# 或者: from core.callhistory.CallHistory import empty_for_board_number [as 别名]
    def from_identifier(self, identifier):
        components = identifier.split("-")
        if len(components) == 2:
            (board_number_string, deal_and_history_identifier) = components
            if ':' in deal_and_history_identifier:
                deal_identifier, call_history_identifier = deal_and_history_identifier.split(':')
                # We have to do a bit of a dance to convert from the board url system that
                # the JS code uses to the one the python uses.
                call_history = CallHistory.from_board_number_and_calls_string(int(board_number_string), call_history_identifier)
            else:
                deal_identifier = deal_and_history_identifier
                call_history = CallHistory.empty_for_board_number(int(board_number_string))
        else:
            (board_number_string, deal_identifier, call_history_identifier) = components
            call_history = CallHistory.from_identifier(call_history_identifier)

        board_number = int(board_number_string)
        deal = Deal.from_identifier(deal_identifier)
        return Board(number=board_number, deal=deal, call_history=call_history)
开发者ID:pdm55,项目名称:saycbridge,代码行数:21,代码来源:board.py

示例2: test_empty_for_board_number

# 需要导入模块: from core.callhistory import CallHistory [as 别名]
# 或者: from core.callhistory.CallHistory import empty_for_board_number [as 别名]
 def test_empty_for_board_number(self):
     self.assertEquals(CallHistory.empty_for_board_number(1).dealer, NORTH)
     self.assertEquals(CallHistory.empty_for_board_number(6).dealer, EAST)
     self.assertEquals(CallHistory.empty_for_board_number(16).dealer, WEST)
开发者ID:abortz,项目名称:saycbridge,代码行数:6,代码来源:test_callhistory.py

示例3: __init__

# 需要导入模块: from core.callhistory import CallHistory [as 别名]
# 或者: from core.callhistory.CallHistory import empty_for_board_number [as 别名]
 def __init__(self, number=None, deal=None, call_history=None):
     self.number = number or 1
     self.deal = deal or Deal.random()
     self.call_history = call_history or CallHistory.empty_for_board_number(number)
开发者ID:pdm55,项目名称:saycbridge,代码行数:6,代码来源:board.py


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