Пример #1
0
 def post(self):
     """
     Processes the req from a client/player to join a gameroom
     """
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url("/"))
     player = Player.from_id(user.user_id())
     if not player.gameroom:
         return Game.join_latest_or_new(player)
     return Game.continue_tournament(player)
Пример #2
0
 def new_game(id):
     g = Game()
     game = games[id]
     g.id = id
     g.teams = [teams_dict[game['team_1']], teams_dict[game['team_2']]]
     if not game['status'] == 1:
         g.scores = None
     else:
         g.scores = [game['score_1'], game['score_2']]
     g.round = game['round']
     return g
Пример #3
0
 def new_game(game):
     g = Game()
     g.id = game['id']
     t1 = game['team_1']
     t2 = game['team_2']
     g.teams = [all_teams[t1], all_teams[t2]]
     if not game['status'] == 1:
         g.scores = None
     else:
         g.scores = [game['scores'][t1], game['scores'][t2]]
     g.round = game['round']
     return g
Пример #4
0
def stage_first_round(teams):
    n_teams = length(teams)
    n_games = n_games//2
    new_games = []
    for ii in range(n_games):
        g=Game()
        g.round = 1
        g.id = 0
        g.teams = [ teams[ii],teams[ii+1] ]
        g.completed = False
        g.scores = [0,0]
        new_games.append(g)
    return new_games
Пример #5
0
 def new_game(id):
     g = Game()
     game = games[id]
     g.id = id
     g.teams = [teams_dict[game['team_1']],teams_dict[game['team_2']]]
     if not game['status'] == 1:
         g.scores = None
     else:
         g.scores = [game['score_1'],game['score_2']]
     g.round = game['round']
     return g
Пример #6
0
 def new_game(game):
     g = Game()
     g.id = game['id']
     t1 = game['team_1']
     t2 = game['team_2']
     g.teams = [all_teams[t1],all_teams[t2]]
     if not game['status'] == 1:
         g.scores = None
     else:
         g.scores = [game['scores'][t1],
                     game['scores'][t2]]
     g.round = game['round']
     return g
Пример #7
0
def stage_first_round(teams):
    n_teams = length(teams)
    n_games = n_games//2
    new_games = []
    for ii in range(n_games):
        g=Game()
        g.round = 1
        g.id = 0
        g.teams = [ teams[ii],teams[ii+1] ]
        g.completed = False
        g.scores = [0,0]
        new_games.append(g)
    return new_games