• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python team.Team类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: unpack_team

def unpack_team(team):
	new_team = Team()
	new_team.name = team['name']
	new_team.slug = team['slug']
	new_team.id = team['id']
	new_team.country = team['country']
	new_team.race = team['race']
	new_team.full_name = team['full_name']
	new_team.country = team['country']
	new_team.image_url = team['image_url']
	return new_team
开发者ID:K4orta,项目名称:abathur,代码行数:11,代码来源:remote_fetch.py


示例17: __init__

 def __init__(self, team_text, agent, username, pokedata, password=None,
              monitor_url=None, proxy=False, browser='phantomjs', predictor_name='PokeFrequencyPredictor',
              verbose=False, kernel_dir="kernel", kernel=False, lib_dir="lib"):
     self.logger = logging.getLogger("showdown")
     self.logger.setLevel(level=logging.INFO)
     self.agent = agent
     self.username = username
     self.password = password
     self.team_text = team_text
     self.predictor_name = predictor_name
     self.monitor_url = monitor_url
     self.battle_url = None
     self.pokedata = pokedata
     self.smogon_data = pokedata.smogon_data
     self.smogon_bw_data = pokedata.smogon_bw_data
     self.graph_move = pokedata.graph_move
     self.graph_poke = pokedata.graph_poke
     self.poke_moves = pokedata.poke_moves
     self.my_team = Team.make_team(team_text, self.smogon_data)
     self.opp_team = None
     self.simulator = Simulator(pokedata)
     arch = platform.architecture()
     self.lib_dir = Path(lib_dir) / OS_MAP[arch[0]][arch[1]]
     self.selenium = Selenium(proxy=proxy, browser=browser, lib_dir=self.lib_dir)
     self.verbose = verbose
     self.kernel_dir = Path(kernel_dir)
     self.kernel = kernel
     if self.kernel and not self.kernel_dir.exists():
         self.kernel_dir.mkdir()
     self.state = KernelState(self.kernel_dir / KERNEL_STATE, self.kernel)
     self.state.update_state("status", "idle")
     if self.verbose:
         self.logger.setLevel(level=logging.DEBUG)
开发者ID:vasumv,项目名称:pokemon_ai,代码行数:33,代码来源:showdown.py


示例18: school

 	def school(self, request):
		cacheKey = request.season
		if cacheKey is None:
			cacheKey = 'AllSchools'
		theCache = memcache.get(cacheKey)
		if theCache is None:
			t = Team()
			schools = []
			for team in t.getSchools(request.season):
				school = School(school=team.school)
				if school not in schools:
					schools.append(school)
			if not memcache.add(cacheKey, schools):
				logging.error('Unable to set cache')
			return SchoolResponse(schools=schools)
		else:
			return SchoolResponse(schools=theCache)
开发者ID:johnsextro,项目名称:ScheduleServer,代码行数:17,代码来源:school_service.py


示例19: setUp

    def setUp(self):
        """
        set up data used in the tests.
        setUp is called before each test function execution.
        """
        self.teams= []
        self.team1 = Team("team1")
        self.team2 = Team("team2")
        pygame.init()
        self.team1.addSnails(2)
        self.team2.addSnails(3)

        self.teams.append(self.team1)
        self.teams.append(self.team2)

        self.turnManager = TurnManager()
        self.turnManager.setTeams(self.teams)
开发者ID:ryuken,项目名称:gravity-snails,代码行数:17,代码来源:unittest_timerquick.py


示例20: reset

 def reset(self):
     self.state.update_state("status", "idle")
     self.logger.info("Resetting...")
     self.simulator.score = 0
     self.simulator.total = 0
     self.selenium.reset()
     self.opp_team = None
     self.my_team = Team.make_team(self.team_text, self.smogon_data)
开发者ID:vasumv,项目名称:pokemon_ai,代码行数:8,代码来源:showdown.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python teamcity.is_running_under_teamcity函数代码示例发布时间:2022-05-27
下一篇:
Python robot.turn函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap