本文整理匯總了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