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