View All-Star Final Vote per league.
 @see https://statsapi.mlb.com/docs/#operation/allStarFinalVote
771311
def all_star_final_vote(league_id, season = nil, options = {})
      options[:season] = season || Time.now.year

      get "/league/#{league_id}/allStarFinalVote", options
    end
1128352
public function scoreResult()
    {
        $result = false;

        if($this->sessionSecret)
        {
            $fields = array(
                'session_secret' => urlencode($this->sessionSecret),
                'scoring_key'    => $this->scoringKey
            );

            $resp = $this->doHttpsPostReturnJSONArray($this->webService, '/ws/scoreGame', $fields);

            if($resp) {
                $result = ($resp->status_code == 1);
            }
        }

        return $result;
    }
1242809
def parse_standings(opt={})
      begin
        url = ParamsBuilder.build_link(opt)
        xml = fetch(url,"standings")
        data = []
        xml.xpath("//team").each do |inf|
        c = ScheduleLine.new

        inf.children.each do |child|
          if(child.is_a?(Nokogiri::XML::Element))
            #puts "#{child.name} - #{child.text}"
            #c.create_line({:name => child.name, :text => child.text})
            c.send("create_#{child.name}", child.text)

          end

          #c.send("#{child.name.to_s}=",child['data'])
        end
        data << c

        end
        return data
      rescue => e
        raise e
      end
    end
252061
def dpr(recalc = false)
			if !@dpr || recalc || @dpr_recalc
				a = alliance_smooshey @ared, @ablue

				# scoreblue and scorered are intentionally
				# swapped; that's how dpr works.
				score = alliance_smooshey @scoreblue, @scorered

				@dpr = opr_calculate a, score
				@dpr_recalc = false
			end

			@dpr
		end
736366
def last_round
      last_round = 0
      @player.values.each do |p|
        p.results.each do |r|
          last_round = r.round if r.round > last_round
        end
      end
      last_round
    end
1368946
public static <X> List<X> mostVotedFor(Map<X, Double> votes) {
        // Choose the label with the greatest number of votes
        // If there is a tie, choose the one with the least index
        double maxTalley = Double.NEGATIVE_INFINITY;
        List<X> maxTickets = new ArrayList<X>();
        for(Entry<X,Double> entry : votes.entrySet()) {
            X ticket = entry.getKey();
            double talley = entry.getValue();
            if (talley > maxTalley) {
                maxTickets = new ArrayList<X>();
                maxTickets.add(ticket);
                maxTalley = talley;
            } else if (talley == maxTalley) {
                maxTickets.add(ticket);
            }
        }
        return maxTickets;
    }
1111051
public function rankingMedalsAction()
    {
        $ranking = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->getRankingMedals($this->getIdPlayer());
        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addRouteItem('Home', 'homepage');
        $breadcrumbs->addItem('player.medalranking.full');

        return $this->render('VideoGamesRecordsCoreBundle:Ranking:player-medals.html.twig', ['ranking' => $ranking]);
    }
315302
private function determineOutcome()
    {
        $outcome = [];
        
        $players = $this->getPlayers();
        $opponents = $players;

        if ($players === false) {
            return false;
        }

        foreach ($players as $player) {
        
            foreach ($opponents as $opponent) {
    
                // dont play the player against themself
                if ($player->getId() === $opponent->getId())
                {
                    continue;
                }

                // move collection
                $player_move = $player->getLastMoveIndex();
                $opponent_move = $opponent->getLastMoveIndex();

                // verify moves have been set
                if (!is_array($player_move)) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' has not set a move!');
                }

                if (!is_array($opponent_move)) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' has not set a move!');
                }

                // move labels
                $player_move_label = ucfirst(key($player_move));
                $opponent_move_label = ucfirst(key($opponent_move));

                // map moves to an index
                $player_move_index = $this->getMoveIndex($player_move);
                $opponent_move_index = $this->getMoveIndex($opponent_move);

                // Exceptions
                if (!is_numeric($player_move_index)) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' made an illegal move!');
                }

                if (!is_numeric($opponent_move_index)) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' made an illegal move!');
                }

                if (current($player_move) === true) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' has already made this move!');
                }

                if (current($opponent_move) === true) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' has already made this move!');
                }

                // compare player with opponent
                if (isset($this->move_outcomes[$player_move_index][$opponent_move_index])) {
                    $outcome['winners'][] = [
                        'player' => $player,
                        'opponent' => $opponent,
                        'description' => $player_move_label . ' ' . $this->move_outcomes[$player_move_index][$opponent_move_index] . ' ' . $opponent_move_label
                    ];
                    $outcome['losers'][] = [
                        'player' => $opponent,
                        'opponent' => $player,
                        'description' => $player_move_label . ' ' . $this->move_outcomes[$player_move_index][$opponent_move_index] . ' ' . $opponent_move_label
                    ];
                } else if (isset($this->move_outcomes[$opponent_move_index][$player_move_index])) {
                    // dont do anything -- we just need to check this in order to determine whether a tie needs to be calculated
                } else {
                    // we just add the tie for the player since the opponent will be added to the ties on later iteration
                    $outcome['ties'][] = [
                        'player' => $player,
                        'opponent' => $opponent,
                        'description' => 'Both played ' . $player_move_label
                    ];
                }
            }
        }

        // mark last moves as played
        foreach ($players as $player) {
            $player->lastMoveIsPlayed();
        }
        
        $this->setOutcome($outcome);
        
        return $this->getRoundOutcome();
    }
790422
function getFinal()
    {
        $lines = array();
        foreach ($this->_edits as $edit) {
            if ($edit->final) {
                array_splice($lines, count($lines), 0, $edit->final);
            }
        }
        return $lines;
    }
911417
def init_pitcher_from_scoreboard(element)
      @first = element.attributes['first']
      @last = element.attributes['last']
      @wins = element.attributes['wins']
      @losses = element.attributes['losses']
      @era = element.attributes['era']
    end
490984
def _get_interleague_fl(cls, home_team_lg, away_team_lg):
        
        if (home_team_lg == MlbamConst.UNKNOWN_SHORT) or (away_team_lg == MlbamConst.UNKNOWN_SHORT):
            return MlbamConst.UNKNOWN_SHORT
        elif home_team_lg != away_team_lg:
            return MlbamConst.FLG_TRUE
        return MlbamConst.FLG_FALSE
29403
public function rankingMedalsAction($id)
    {
        $rankingMedals = $this
            ->getDoctrine()
            ->getRepository('VideoGamesRecordsCoreBundle:PlayerSerie')
            ->getRankingMedals($id, $this->getPlayer(), 100);

        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addRouteItem('Home', 'homepage');
        $breadcrumbs->addItem('serie.medalranking.full');

        return $this->render('VideoGamesRecordsCoreBundle:Ranking:player-medals.html.twig', ['rankingMedals' => $rankingMedals]);
    }
1861
function TieBreaker(oldRes, posAry, limit, opts) {
  if (!(this instanceof TieBreaker)) {
    return new TieBreaker(oldRes, posAry, limit, opts);
  }
  this._opts = TieBreaker.defaults(opts);
  var invReason = TieBreaker.invalid(oldRes, posAry, this._opts, limit);
  if (invReason !== null) {
    this._opts.log.error('Invalid %d player TieBreaker with oldRes=%j rejected, opts=%j',
      limit, oldRes, this._opts
    );
    throw new Error('Cannot construct TieBreaker: ' + invReason);
  }

  var xs = createMatches(posAry, limit, this._opts);
  var ms = [];
  if (this._opts.grouped) {
    for (var i = 0; i < xs.length; i += 1) {
      for (var j = 0; j < xs[i].matches.length; j += 1) {
        var m = xs[i].matches[j];
        // NB: modifying the matches here so that outside world sees the section
        // corr. to the section they came from - whereas gs inst needs s === 1
        ms.push({
          id: new Id(xs[i].tbSection, m.id.r, m.id.m),
          p: m.p.slice()
        });
      }
    }
    this.groupStages = xs;
  }
  else {
    ms = xs;
  }

  Base.call(this, oldRes.length, ms);
  this.name = 'TieBreaker';
  this.grouped = this._opts.grouped;
  this.strict = this._opts.strict;
  this.posAry = posAry;
  this.limit = limit;
  this.oldRes = oldRes;
  this.numSections = posAry.length;
  this.sectionSize = $.flatten(posAry[0]).length;
  this.betweenPosition = Math.ceil(this.limit / this.numSections);

  // Demote player positions until we are done

  // Demotion must unfortunately happen here, and not in previous tourneys results.
  // This is because demotion will change depending on what limits we choose.
  // While this means if we bypass TB we may end up forwarding unfairly (perhaps
  // more players from one group than another), TB is here to fix it, so use it.
  var pls = this.players(); // the players that are actually in matches here
  this.numPlayers = pls.length; // override this.numPlayers set via Base.call(this)
  var playersGuaranteed = oldRes.filter(function (r) {
    return pls.indexOf(r.seed) < 0 && r.pos <= limit;
  }).length;
  oldRes.forEach(function (r) {
    if (pls.indexOf(r.seed) >= 0) {
      r.pos = pls.length + playersGuaranteed;
    }
  });
}
1108572
public function majRankMedal()
    {
        $players = $this->findBy(array(), array('chartRank0' => 'DESC', 'chartRank1' => 'DESC', 'chartRank2' => 'DESC', 'chartRank3' => 'DESC'));

        Ranking::addObjectRank($players, 'rankMedal', array('chartRank0', 'chartRank1', 'chartRank2', 'chartRank3'));
        $this->getEntityManager()->flush();
    }
130562
def get_vs_ab
      results = []
      abs = get_game.get_atbats
      abs.each do |ab|
        if ab.pitcher_id == @pid
          results << ab
        end
      end
      results
    end
1109836
public function getPlayersString()
    {
        $teams = $this->rec->teams();

        $teamMembers = array_map($teams, function (&$team) {
            // Count non-cooping players.
            return array_reduce($team->players(), function ($count, &$player) {
                return $player->isCooping ? $count : $count + 1;
            }, 0);
        });

        // Remove teams without players.
        $teamMembers = array_diff($teamMembers, [0]);
        if (array_sum($teamMembers) === count($teams) && count($teams) > 2) {
            return 'FFA';
        } else {
            return implode('v', $teamMembers);
        }
    }
582127
public function results()
    {
        // Finish all
        $this->finishLastPoint();

        // Finish all multiple points
        $this->finishAllMultiplePoints();

        // Add results to presenter
        $this->presenter->displayResultsTrigger($this->pointStack);

        // Return export
        return $this->export();
    }