Get a Condorcet certified winner. If there is none = null. You can force a winner choice with alternative supported methods ($substitution)
179835
public function getWinner () : ?int
    {
        // Cache
        if ( $this->_CondorcetWinner !== null ) :
            return $this->_CondorcetWinner;
        endif;

            //////

        // Basic Condorcet calculation
        foreach ( $this->_selfElection->getPairwise(false) as $candidate_key => $candidat_detail ) :
            $winner = true;

            foreach ($candidat_detail['win'] as $challenger_key => $win_count ) :
                if  ( $win_count <= $candidat_detail['lose'][$challenger_key] ) :
                    $winner = false;
                    break;
                endif;
            endforeach;

            if ($winner) :
                $this->_CondorcetWinner = $candidate_key;
                return $this->_CondorcetWinner;
            endif;
        endforeach;

            return null;
    }
895397
public function getResult () : Result
    {
        // Cache
        if ( $this->_Result === null ) :
            $this->calcPossibleRanking();
            $this->calcRankingScore();
            $this->makeRanking();
            $this->conflictInfos();
        endif;

        // Return
        return $this->_Result;
    }
1314395
public function getValue() : ?string
    {
        foreach ($this->getOptions() as $option) {
            if ($option->isSelected()) {
                return $option->getValue();
            }
        }

        return null;
    }
574572
@Nullable
    public Object getResult(TBase<?, ?> result) throws TException {
        for (TFieldIdEnum fieldIdEnum : exceptionFields()) {
            if (ThriftFieldAccess.isSet(result, fieldIdEnum)) {
                throw (TException) ThriftFieldAccess.get(result, fieldIdEnum);
            }
        }

        final TFieldIdEnum successField = successField();
        if (successField == null) { //void method
            return null;
        } else if (ThriftFieldAccess.isSet(result, successField)) {
            return ThriftFieldAccess.get(result, successField);
        } else {
            throw new TApplicationException(
                    TApplicationException.MISSING_RESULT,
                    result.getClass().getName() + '.' + successField.getFieldName());
        }
    }
115674
protected function prepareResult () : bool
    {
        if ($this->_State > 2) :
            return false;
        elseif ($this->_State === 2) :
            $this->cleanupResult();

            // Do Pairewise
            $this->makePairwise();

            // Change state to result
            $this->_State = 3;

            // Return
            return true;
        else :
            throw new CondorcetException(6);
        endif;
    }
1103030
def result(self, *, claim_draw: bool = False) -> str:
        
        # Chess variant support.
        if self.is_variant_loss():
            return "0-1" if self.turn == WHITE else "1-0"
        elif self.is_variant_win():
            return "1-0" if self.turn == WHITE else "0-1"
        elif self.is_variant_draw():
            return "1/2-1/2"

        # Checkmate.
        if self.is_checkmate():
            return "0-1" if self.turn == WHITE else "1-0"

        # Draw claimed.
        if claim_draw and self.can_claim_draw():
            return "1/2-1/2"

        # Seventyfive-move rule or fivefold repetition.
        if self.is_seventyfive_moves() or self.is_fivefold_repetition():
            return "1/2-1/2"

        # Insufficient material.
        if self.is_insufficient_material():
            return "1/2-1/2"

        # Stalemate.
        if not any(self.generate_legal_moves()):
            return "1/2-1/2"

        # Undetermined.
        return "*"
699054
def get_result(self, errors=GRACEFUL, **params):
        
        additional_params = self.get_additional_params(**params)
        return self.poll_session(
            self.create_session(**params),
            errors=errors,
            **additional_params
        )
29243
public function get()
    {
        foreach ($this->_strategies as $strategy) {
            $result = $strategy->get();
            if ($result !== null) {
                return $result;
            }
        }

        return null;
    }
1301270
private function getNonce(string $uri): Promise {
        if (empty($this->nonces)) {
            return $this->requestNonce($uri);
        }

        return new Success(array_shift($this->nonces));
    }
1107085
public function getResult () : Result
    {
        // Cache
        if ( $this->_Result !== null ) :
            return $this->_Result;
        endif;

            //////

        // Sort pairwise
        $this->_PairwiseSort = $this->pairwiseSort();

        // Ranking calculation
        $this->makeArcs();

        // Make Stats
        $this->_Stats['tally'] = $this->_PairwiseSort;
        $this->_Stats['arcs'] = $this->_Arcs;

        // Make Result      
        return $this->_Result = $this->createResult($this->makeResult());
    }
145357
function selectWithoutValidation(choices) {
	// Generate a list of options with positive non-zero chances
	let choicesWithNonZeroChances = [];
	let totalWeight = 0.0;
	for(let i = 0; i < choices.length; i++) {
		if(choices[i].chance > 0.0) {
			choicesWithNonZeroChances.push(choices[i]);
			totalWeight += choices[i].chance;
		}
	}

	// Pick a random value from [0,1)
	let value = Math.random() * totalWeight;

	// Iterate over possibilities until we find the selected one
	let chanceCovered = 0.0;
	for(let i = 0; i < choicesWithNonZeroChances.length; i++) {
		chanceCovered += choicesWithNonZeroChances[i].chance;
		if(value < chanceCovered) {
			return choicesWithNonZeroChances[i].result;
		}
	}
}
994964
public function prizeAction()
    {
        $prizeIdentifier = $this->getEvent()->getRouteMatch()->getParam('prize');
        $prize           = $this->getPrizeService()->getPrizeMapper()->findByIdentifier($prizeIdentifier);

        if (!$prize) {
            return $this->notFoundAction();
        }

        $viewModel = $this->buildView($this->game);
        $viewModel->setVariables(array('prize' => $prize));

        return $viewModel;
    }
1325295
def get_opt( self, opt):
    
    if self.__options.has_key(opt):
      return self.__options[opt]
    return None
1266045
@Override
  public Selection<E> value() {
    return value == null ? null : new Selection<E>() {
      @Override
      public E result() {
        return value;
      }

      @Override
      public Object target() {
        return target;
      }
    };
  }
123699
private function getQualityFactor($locale, $option)
    {
        if (isset($option[1]))
            return (float) str_replace('q=', '', $option[1]);

        // Assign default low weight for generic values
        if ($locale === '*/*')
            return 0.01;

        if (substr($locale, -1) === '*')
            return 0.02;

        return null;
    }
187641
public function addCandidate ($candidate_id = null) : Candidate
    {
        // only if the vote has not started
        if ( $this->_State > 1 ) :
            throw new CondorcetException(2);
        endif;

        // Filter
        if ( is_bool($candidate_id) || is_array($candidate_id) || (is_object($candidate_id) && !($candidate_id instanceof Candidate)) ) :
            throw new CondorcetException(1, $candidate_id);
        endif;


        // Process
        if ( empty($candidate_id) ) :
            while ( !$this->canAddCandidate($this->_i_CandidateId) ) :
                $this->_i_CandidateId++;
            endwhile;

            $newCandidate = new Candidate($this->_i_CandidateId);
        else : // Try to add the candidate_id
            $newCandidate = ($candidate_id instanceof Candidate) ? $candidate_id : new Candidate ((string) $candidate_id);

            if ( !$this->canAddCandidate($newCandidate) ) :
                throw new CondorcetException(3,$candidate_id);
            endif;
        endif;

        // Register it
        $this->_Candidates[] = $newCandidate;

        // Linking
        $newCandidate->registerLink($this);

        // Disallow other candidate object name matching 
        $newCandidate->setProvisionalState(false);

        return $newCandidate;
    }
45350
public function getCascadeOption($cascadeValue)
    {
        $defaultCascade = $this->getRegistry()->config->get(static::CFG_DEFAULT_CASCADE);
        if (empty($cascadeValue) && !empty($defaultCascade)) {
            return [$defaultCascade];
        }

        /** @var Validator $validator */
        $validator = $this->getRegistry()->validator->get(static::CFG_DEFAULT_CASCADE);

        $cascadeValue = array_map('strtolower', array_map('trim', explode(',', $cascadeValue)));
        $cascadeValue = array_intersect($cascadeValue, $validator->getChoices());
        $cascadeValue = array_filter($cascadeValue);
        if(empty($cascadeValue)) {
            return null;
        }

        return $cascadeValue;
    }