本文整理汇总了Python中models.team.Team.get_player方法的典型用法代码示例。如果您正苦于以下问题:Python Team.get_player方法的具体用法?Python Team.get_player怎么用?Python Team.get_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.team.Team
的用法示例。
在下文中一共展示了Team.get_player方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import get_player [as 别名]
def post(self):
req = request.get_json()
offense = req['offense']
defense = req['defense']
off_players = [Player(**player) for player in offense['players']]
def_players = [Player(**player) for player in defense['players']]
off_gameplan = Gameplan(50, 50)
def_gameplan = Gameplan(50, 50)
off_team = Team(off_players, off_gameplan, offense['team_mod'])
def_team = Team(def_players, def_gameplan, defense['team_mod'])
results = []
touchdowns = 0
fumbles = 0
forcers = []
for x in range(0, random.randint(250, 350)):
response = execute_run_play(1, 1, 10, random.randint(5, 80),
off_team.get_player('RB', 1),
off_team.get_player('RB', 2),
off_team.get_player('FB', 1),
off_team.get_player('TE', 1),
off_team,
def_team,
off_team.team_mod - def_team.team_mod,
off_team.run_blocking - def_team.run_defense)
results.append(int(response[0]))
touchdowns += response[1]
fumbles += 1 if response[2] else 0
if response[3] is not None:
forcers.append(response[3])
return Response('Troy White: '
+ str(len(results))
+ ' for ' + str(sum(results))
+ ' yards, '
+ str(touchdowns)
+ ' TD for an average of '
+ str(sum(results) / float(len(results))) + '. Long: '
+ str(max(results))
+ ' Fumbles: '
+ str(fumbles)
+ ' [%s]' % ', '.join(map(str, forcers)))