Create a new tournament.
968311
def create(name, url, tournament_type="single elimination", **params):
    """"""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
99541
def create(self):
        """"""
        body = dict()
        if self.mapping is not None:
            body['mappings'] = self.mapping
        if self.settings is not None:
            body['settings'] = self.settings
        else:
            body['settings'] = self._default_settings()
        self.instance.indices.create(self.index, body)
876163
def create():
    """"""
    if not all(map(os.path.isdir, ARGS.directory)):
        exit('Error: One or more of the specified directories does not exist.')
    with sqlite3.connect(ARGS.database) as connection:
        connection.text_factory = str
        cursor = connection.cursor()
        cursor.execute('DROP TABLE IF EXISTS Movies')
        cursor.execute('''CREATE TABLE Movies(name TEXT, path TEXT, size TEXT,
                          files BLOB)''')
        for dir in ARGS.directory:
            cursor.executemany('INSERT INTO Movies VALUES(?, ?, ?, ?)',
                               local_data(dir))
91671
def new_game(self):
        """"""
        self.game = self.game_class(self, self.screen)
        self.save()
22473
public function start()
    {
        if ($this->state != 'pending') {
            throw new AlreadyStartedException('Tournament is already underway.');
        }

        $response = Guzzle::post("tournaments/{$this->id}/start");
        return $this->updateModel($response->tournament);
    }
1107251
def merge_arena(self, mujoco_arena):
        """"""
        self.arena = mujoco_arena
        self.table_top_offset = mujoco_arena.table_top_abs
        self.table_size = mujoco_arena.table_full_size
        self.merge(mujoco_arena)
1348974
function restartGame(players) {
    // Replace the current instance with a new instance
    let newGame = new RockPaperScissors(game, players, winCounter, id);
    proxy.swap(newGame);

    q.delay(RESULTS_DELAY)
      .done(function() {
        deferred.resolve(newGame.handleIt(callbacks));
      });
  }
942806
def tournament(self, negative=False):
        """"""
        if self.generation <= self._random_generations and not negative:
            return self.random_selection()
        if not self._negative_selection and negative:
            return self.random_selection(negative=negative)
        vars = self.random()
        fit = [(k, self.population[x].fitness) for k, x in enumerate(vars)]
        if negative:
            fit = min(fit, key=lambda x: x[1])
        else:
            fit = max(fit, key=lambda x: x[1])
        index = fit[0]
        return vars[index]
285793
def send_game(self, *args, **kwargs):
        """"""
        return send_game(*args, **self._merge_overrides(**kwargs)).run()
385087
def create():
    """"""
    if request.method == "POST":
        title = request.form["title"]
        body = request.form["body"]
        error = None

        if not title:
            error = "Title is required."

        if error is not None:
            flash(error)
        else:
            db.session.add(Post(title=title, body=body, author=g.user))
            db.session.commit()
            return redirect(url_for("blog.index"))

    return render_template("blog/create.html")
1127164
async function initiateGame(team1, team2, pitchDetails) {
  validate.validateArguments(team1, team2, pitchDetails)
  validate.validateTeam(team1)
  validate.validateTeam(team2)
  validate.validatePitch(pitchDetails)
  let matchDetails = setVariables.populateMatchDetails(team1, team2, pitchDetails)
  let kickOffTeam = setVariables.setGameVariables(matchDetails.kickOffTeam)
  let secondTeam = setVariables.setGameVariables(matchDetails.secondTeam)
  kickOffTeam = setVariables.koDecider(kickOffTeam, matchDetails)
  matchDetails.iterationLog.push(`Team to kick off - ${kickOffTeam.name}`)
  matchDetails.iterationLog.push(`Second team - ${secondTeam.name}`)
  secondTeam = setPositions.switchSide(secondTeam, matchDetails)
  matchDetails.kickOffTeam = kickOffTeam
  matchDetails.secondTeam = secondTeam
  return matchDetails
}
1331694
def add(self, member, score):
        """"""
        return self.client.zadd(self.name, member, score)
862760
def inflate(self, newData={}):
        """"""
        from sc2maptool.functions import selectMap
        from sc2maptool.mapRecord import MapRecord
        self.__dict__.update(newData)
        #if not isinstance(self.state, types.GameStates):      self.state     = types.GameStates(self.state)
        if self.expo    and not isinstance(self.expo, types.ExpansionNames):    self.expo       = types.ExpansionNames(self.expo)
        if self.version and not isinstance(self.version, versions.Version):     self.version    = versions.Version(self.version)
        if self.ladder  and not isinstance(self.ladder, Ladder):                self.ladder     = Ladder(self.ladder)
        for i,player in enumerate(self.players): # iterate over all players
            if       isinstance(player, str):                                   self.players[i] = getPlayer(player)
            elif not isinstance(player, PlayerRecord):                          self.players[i] = buildPlayer(*player)
        if self.mode    and not isinstance(self.mode, types.GameModes):         self.mode       = types.GameModes(self.mode)
        if self.themap  and not isinstance(self.themap, MapRecord):             self.themap     = selectMap(name=self.themap)
171664
function (progress, adv) {
  if (progress) {
    var id = progress[0]
      , pos = progress[1]
      , insertM = this.findMatch(id);

    if (!insertM) {
      throw new Error('tournament corrupt: ' + id + ' not found!');
    }

    insertM.p[pos] = adv;
    if (insertM.p[(pos + 1) % 2] === WO) {
      insertM.m = (pos) ? [0, 1] : [1, 0]; // set WO map scores
      return insertM.id; // this id was won by adv on WO, inform
    }
  }
}
331155
def create(game, normalize_returns=False, settings=None, presets=None):
    
    return MujocoEnv(
        envname=game,
        normalize_returns=normalize_returns,
        settings=settings,
        presets=presets
    )
1106457
private void createBallModel(final JRebirthEvent event) {
        switch (event.eventType()) {
            case CREATE_APPLICATION:
            case CREATE_NOTIFIER:
            case CREATE_GLOBAL_FACADE:
            case CREATE_COMMAND_FACADE:
            case CREATE_SERVICE_FACADE:
            case CREATE_UI_FACADE:
            case CREATE_COMMAND:
            case CREATE_SERVICE:
            case CREATE_MODEL:
            case CREATE_VIEW:
            case CREATE_CONTROLLER:
                // final BallModel ballModel = getModel(BallModel.class, event);
                callCommand(CreateBallCommand.class, WBuilder.waveData(EditorWaves.EVENT, event));
                break;
            case CREATE_WAVE:
            default:
        }

    }
1008962
def leaderboard(round_num=0, tournament=1):
    """"""
    click.echo(prettify(napi.get_leaderboard(tournament=tournament,
                                             round_num=round_num)))