本文整理汇总了Python中GameState.nextDealer方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.nextDealer方法的具体用法?Python GameState.nextDealer怎么用?Python GameState.nextDealer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.nextDealer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: players
# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import nextDealer [as 别名]
#.........这里部分代码省略.........
# socket - socket for client
# tokens - tokens of message from client
# Notes:
# Also starts game when all players have registered.
# Should this be changed??
#
def processClientMessage(self, socket, tokens):
if tokens[0] == 'LOGOUT':
self.logoutPlayer(socket)
elif self.state == 'REGISTRATION' or self.state == 'RESTART':
print "Registration state."
if tokens[0] == 'LOGIN':
print 'Login: ', tokens[1]
self.loginPlayer(socket, tokens[1])
if self.numReadyPlayers == self.numPlayers:
print "Players Ready."
# if new game
if self.state == 'REGISTRATION':
self.playGame(0, -1)
else: # restarting interrupted game
scores = self.gameState.currentScores()
for i in range(self.numPlayers):
self.players[i].score = scores[i]
self.playGame( self.gameState.numHands(),
self.gameState.nextDealer())
raise 'End server'
else:
print 'Error'
socket.send('ERROR Unknown\n')
#
# logs out player
# Parameter:
# socket - socket of player
#
def logoutPlayer( self, socket ):
player = findPlayer(socket)
if player is not None:
i = self.players.index(player)
del self.players[i]
player.sendMessage('OK')
else:
socket.send('ERROR\n')
#
# broadcast a message to all players
# Parameter:
# msg - text of message
#
def broadcastMessage( self, msg ):
for player in self.players:
player.sendMessage(msg)
#
# make a list of numbers of tricks for each hand