本文整理汇总了Python中table.Table.new_table_id方法的典型用法代码示例。如果您正苦于以下问题:Python Table.new_table_id方法的具体用法?Python Table.new_table_id怎么用?Python Table.new_table_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.new_table_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _on_register
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import new_table_id [as 别名]
def _on_register(self, username):
self.nick = username
self.send({'registered': self.nick})
#score = self._get_score(self.nick)
#self.send({'update_score': score})
while self._waiting:
opponent = self._waiting.pop()
if opponent.is_closed:
continue
self._opponents[self.session].append(opponent)
self._opponents[opponent.session].append(self)
self.send({'status': "playing against " + opponent.nick,
'ready': True})
opponent.send({'status': "playing against " + self.nick,
'ready': True})
table_id = Table.new_table_id()
players = [self, opponent]
for player in players:
player.table_id = table_id
player.changes = 0
table = Table(players)
self._tables[table_id] = table # could be more
table.deal_5_cards_each()
for player in table.players:
player.send({'hand': player.cards})
else:
self._waiting.append(self)
self.send({'status': 'Waiting', 'color': 'orange'})