本文整理汇总了Python中match.Match.getWinner方法的典型用法代码示例。如果您正苦于以下问题:Python Match.getWinner方法的具体用法?Python Match.getWinner怎么用?Python Match.getWinner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类match.Match
的用法示例。
在下文中一共展示了Match.getWinner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Player
# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import getWinner [as 别名]
from player import Player
from match import Match
import random
john = Player('John')
rafa = Player('Rafa')
RolandGarros = Match("Roland Garros")
RolandGarros.addPlayer1(john)
RolandGarros.addPlayer2(rafa)
while RolandGarros.getWinner() is None:
pointWinner = random.choice([Match.PLAYER1,Match.PLAYER2]);
player = RolandGarros.getPlayer(pointWinner)
RolandGarros.winPoint(pointWinner)
print 'Player ' + player.name + ' win point - Current score: ' + str(RolandGarros.getScore(Match.PLAYER1)) + ' / ' + str(RolandGarros.getScore(Match.PLAYER2))
winner = RolandGarros.getPlayer(pointWinner)
print 'The winner is ' + winner.name