当前位置: 首页>>代码示例>>Python>>正文


Python team.Team类代码示例

本文整理汇总了Python中team.Team的典型用法代码示例。如果您正苦于以下问题:Python Team类的具体用法?Python Team怎么用?Python Team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Team类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: game

def game(team_name1, team_name2):

  team_a = Team(team_name1, Sides.CT)
  team_b = Team(team_name2, Sides.T)
  for i in range(Constants.GAMES_TO_PLAY):
    pistol = True
    for j in range(30):
      gmap = Game_Map()

      env = simpy.Environment()
      if (j == 16):
        switch_sides(team_a, team_b)
        pistol = True

      if (team_a.side == Sides.CT):
        team_a.respawn_players(env, pistol)
        team_b.respawn_players(env, pistol)
      else:
        team_b.respawn_players(env, pistol)
        team_a.respawn_players(env, pistol)
      pistol = False



      gmap.spawn_team(team_a)
      gmap.spawn_team(team_b)
      env.run(env.process(round(team_a, team_b, env)))

      if (team_a.round_wins == 16 or team_b.round_wins == 16):
        break
    game_over(team_a, team_b)
  print team_a
  print team_b
  return [float(team_a.game_wins)/float(team_a.game_wins + team_b.game_wins)*100, 
    float(team_a.total_round_wins)/ float(team_a.total_round_wins + team_b.total_round_wins) * 100]
开发者ID:vmgarcia,项目名称:CSGOSim,代码行数:35,代码来源:game.py

示例2: get

	def get(self):
		start_time = time.time()
		availSeasons = AvailableSeasons()
		for s in availSeasons.getSeasons():
			logging.info("Beginning data load for season %d" % s.season)
			teamIds = self.get_team_ids(s.season)
			stcharlesurl = "http://www.cycstcharles.com/schedule.php?team=%s&pfv=y&sort=date&month=999&year=999&season=%d"
			for team_id in teamIds:
				team_url = stcharlesurl % (team_id[1], s.season)
				self.fetch_team_schedule(team_url, team_id)
			logging.info("Finished loading schedule data. Elapsed time (in mins): " + str((time.time() - start_time)/60))

		if memcache.flush_all():
			logging.info("Flushed everything from memcache.")
		else:
			logging.error("Error trying to flush the memcache.")

		t = Team()
		seasons = []
		for team in t.getSeasons():
			season = Season(season=team.season)
			if season not in seasons:
				seasons.append(season)
		if not memcache.add('seasons', seasons):
			logging.error('memcache failed to set')
开发者ID:johnsextro,项目名称:saintsApp,代码行数:25,代码来源:load.py

示例3: _load_metadata

    def _load_metadata(self):
        fname = self._metadata_fname()
        with open(fname) as f:
            data=json.load(f)

        assert data['id'] == self._id, "metadata id is {0} but should be {1}".format(data['id'], self._id)
        self.team_l = Team.decode(data['team_l'])
        self.team_r = Team.decode(data['team_r'])
开发者ID:joaoportela,项目名称:RoboCup-strategy-adviser-coach,代码行数:8,代码来源:match.py

示例4: create_teams

 def create_teams(self):
     self.team_red = Team(self, 'Red Team', 'red', team_red_POSITIONS, True)
     self.team_blue = Team(self, 'Blue Team', 'blue', team_blue_POSITIONS, False)
     self.current_team = self.team_red
     self.teams = (self.team_red, self.team_blue)
     
     self.team_red.add_listener('released', self.movement_started)
     self.team_blue.add_listener('released', self.movement_started)
开发者ID:macartur-UNB,项目名称:BS,代码行数:8,代码来源:main.py

示例5: post

 def post(self):
   from user_sn import User, send_welcome_msg
   from team import Team
   import logging
   t = Team(name=self.request.get("teamname"))
   t.put()
   u = User(email=self.request.get("tlemail"),name=self.request.get("teamleader"),team=t,team_leader_flag=True)
   u.put()
   send_welcome_msg(u)
开发者ID:FffD,项目名称:sneakernet,代码行数:9,代码来源:makenewteam.py

示例6: setUp

 def setUp(self):
     """
     set up data used in the tests.
     setUp is called before each test function execution.
     """        
     self.maxSnails = 3
     self.team1 = Team("team1")
     self.team2 = Team("team2")
     self.team1.setGravity(Direction.UP)
     self.team2.setGravity(Direction.DOWN)
开发者ID:ryuken,项目名称:gravity-snails,代码行数:10,代码来源:unittest_team.py

示例7: games

    def games(self, request):
		t = Team()
		responseArray = []
		schedule = t.getGamesMultiTeams(request.team_ids)
		gamesArray = eval(schedule)
		for game in gamesArray:
			logging.info(game)
			responseGame = Games(game_date=game['game_date'][5:], time=game['time'], home=game['home'], away=game['away'], location=game['location'], game_id=game['id'], score=game['score'])
			responseArray.append(responseGame)
		return GamesMultiTeamResponse(games=responseArray)
开发者ID:johnsextro,项目名称:ScheduleServer,代码行数:10,代码来源:game_multi_team_service.py

示例8: teamCreate

 def teamCreate(self):
     newTeam = Team()
     newTeam.create(self)
     self.iscaption=1
     self.team=newTeam  # 是指向队伍实例吧.? S 那边只能 self.team=newTeam.name
     self.teamName=newTeam.name
     draw.drawTeamMember(newTeam)
     print "创建队伍:" ,self.team
     teamManager.add(newTeam)
     playerManager.add(self)
开发者ID:lotaku,项目名称:board-game,代码行数:10,代码来源:player.py

示例9: main

def main():
    if "-c" in sys.argv:
        clean()
    val = load()
    t = Team(val)

    if "-r" in sys.argv:
        t.removeOut()

    t.build(budget)
开发者ID:BookMakers,项目名称:lol_maker,代码行数:10,代码来源:builder.py

示例10: build_teams

 def build_teams(self):
     team_ids = set()
     for row in self.owner_rows:
         team_ids.add(row.get('id')[:-2])
     for id in team_ids:
         team = Team(id)
         this_team_element = self.owners_page_root.get_element_by_id(id + "-0")
         team.abbreviation = this_team_element[1].text_content()
         team.name = this_team_element[2].text_content()
         team.division = this_team_element[3].text_content()
         self.teams.add(team)
开发者ID:theampersand,项目名称:Baseball,代码行数:11,代码来源:OwnerInfoPageScraper.py

示例11: gs2cOtherTeamCreate

def gs2cOtherTeamCreate(player,packet):
    playerName = packet.unpackString()
    teamName= packet.unpackString()
    playerGeted = playerManager.getPlayerByName(playerName)
    newTeam = Team()
    newTeam.create(playerGeted)
    playerGeted.iscaption =1
    playerGeted.team=newTeam.name
    playerGeted.teamName=teamName
    teamManager.add(newTeam)
    playerManager.add(playerGeted)
开发者ID:lotaku,项目名称:board-game,代码行数:11,代码来源:player.py

示例12: npc_match

	def npc_match(team1, team2, players, teams):
		team1Name = Team.return_name(teams[team1])
		team2Name = Team.return_name(teams[team2])		
		difference= CoreGame.mute_compare_players(team1, team2, players, team1Name, team2Name)
		winner = CoreGame.find_winner(0, 0, 0, difference)
		if winner == 0:
			Team.won_game(teams[team1])
			Team.lost_game(teams[team2])
		elif winner == 1:
			Team.lost_game(teams[team1])
			Team.won_game(teams[team2])
开发者ID:Civil-JE,项目名称:Text-Based-LCS,代码行数:11,代码来源:MSim.py

示例13: main

def main():
    from argparse import ArgumentParser

    argparser = ArgumentParser()
    argparser.add_argument('team1')
    argparser.add_argument('team2')
    argparser.add_argument('--depth', type=int, default=2)
    argparser.add_argument('--gamestate', type=str)
    argparser.add_argument('--player', type=int, default=0)
    args = argparser.parse_args()
    pokedata = load_data("data")

    players = [None, None]
    # players[args.player] = HumanAgent()
    players[args.player] = PessimisticMinimaxAgent(2, pokedata, log_file="normal.txt")
    # players[1 - args.player] = PessimisticMinimaxAgent(2, pokedata, log_file="no_cache.txt", use_cache=False)
    # players[1 - args.player] = DumbAgent()
    players[1 - args.player] = HumanAgent()

    with open(args.team1) as f1, open(args.team2) as f2, open("data/poke2.json") as f3:
        data = json.loads(f3.read())
        poke_dict = Smogon.convert_to_dict(data)
        teams = [Team.make_team(f1.read(), poke_dict), Team.make_team(f2.read(), poke_dict)]

    gamestate = GameState(teams)
    if args.gamestate is not None:
        with open(args.gamestate, 'rb') as fp:
            gamestate = pickle.load(fp)
    with open('cur2.gs', 'wb') as fp:
        pickle.dump(gamestate, fp)
    gamestate.create_gamestate_arff(0)
    gamestate.print_readable_data(0)
    gamestate.print_readable_data(1)
    simulator = Simulator(pokedata)
    while not gamestate.is_over():
        print "=========================================================================================="
        print "Player 1 primary:", gamestate.get_team(0).primary(), gamestate.get_team(0).primary().status
        print "Player 2 primary:", gamestate.get_team(1).primary(), gamestate.get_team(1).primary().status
        print ""

        my_action = players[0].get_action(gamestate, 0)
        opp_action = players[1].get_action(gamestate, 1)
        gamestate = simulator.simulate(gamestate, [my_action, opp_action], 0, log=True)
    if gamestate.get_team(0).alive():
        print "You win!"
        print "Congrats to", gamestate.opp_team
        print "Sucks for", gamestate.my_team
    else:
        print "You lose!"
        print "Congrats to", gamestate.my_team
        print "Sucks for", gamestate.opp_team
    gamestate.turn += 1
开发者ID:jy19,项目名称:CS478-Pokemon,代码行数:52,代码来源:game.py

示例14: season

 def season(self, request):
     theCache = memcache.get("seasons")
     if theCache is None:
         t = Team()
         seasons = []
         for team in t.getSeasons():
             season = Season(season=team.season)
             if season not in seasons:
                 seasons.append(season)
         if not memcache.add("seasons", seasons):
             logging.error("memcache failed to set")
         return SeasonResponse(seasons=seasons)
     else:
         return SeasonResponse(seasons=theCache)
开发者ID:johnsextro,项目名称:ScheduleServer,代码行数:14,代码来源:season_service.py

示例15: top_trading_cycles

def top_trading_cycles(teams,users):
    while teams:
        graph = {}
        for team in teams:
            for user in team.user_prefs(users):
                if(Team.team_with_user(teams,user)):
                    graph[team] = (Team.team_with_user(teams,user),user)
                    break
        cycles = detect_cycles(graph)
        for cycle in cycles:
            for team in cycle:
                team.take_user_from(graph[team][0],graph[team][1])
            for team in cycle:
                teams.pop(teams.index(team))
开发者ID:TheAkbar,项目名称:IntelligentAssignment,代码行数:14,代码来源:top_trading_cycles.py


注:本文中的team.Team类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。