Calculate the Byes needed to fill the Championship Tree.

@param $fighters

@return Collection
975557
protected function getByeGroup($fighters)
    {
        $fighterCount = $fighters->count();
        $firstRoundGroupSize = $this->firstRoundGroupSize(); // Get the size of groups in the first round (2,3,4)
        // Max number of fighters for the first round
        $treeSize = $this->getTreeSize($fighterCount, $firstRoundGroupSize);
        $byeCount = $treeSize - $fighterCount;
        return $this->createByeGroup($byeCount);
    }
660364
public function toDbTableRows($entities)
    {
        $collection = new Collection();
        foreach ($entities as $entity) {
            $collection->push($this->toDbTableRow($entity));
        }

        return $collection;
    }
976061
public function getChampion($championId)
	{
		if ( ! isset($this->info['champions'][$championId]))
		{
			return null;
		}

		return $this->info['champions'][$championId];
	}
540054
public function getChampion($championId)
    {
        foreach($this->info as $mastery) {
            if($mastery->championId == $championId)
                return $mastery;
        }
        return null;
    }
1356451
public function get_guide_filling($force = false) {
        global $DB;
        if ($this->guide === null || $force) {
            $records = $DB->get_records('gradingform_guide_fillings', array('instanceid' => $this->get_id()));
            $this->guide = array('criteria' => array());
            foreach ($records as $record) {
                $record->score = (float)$record->score; // Strip trailing 0.
                $this->guide['criteria'][$record->criterionid] = (array)$record;
            }
        }
        return $this->guide;
    }
36964
public function getChildren(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        if (null === $this->collNestedSetChildren || null !== $criteria) {
            if ($this->isLeaf() || ($this->isNew() && null === $this->collNestedSetChildren)) {
                // return empty collection
                $this->initNestedSetChildren();
            } else {
                $collNestedSetChildren = ChildCategoryQuery::create(null, $criteria)
                    ->childrenOf($this)
                    ->orderByBranch()
                    ->find($con);
                if (null !== $criteria) {
                    return $collNestedSetChildren;
                }
                $this->collNestedSetChildren = $collNestedSetChildren;
            }
        }

        return $this->collNestedSetChildren;
    }
1230253
public function getFightNumber(): FightNumber
    {
        if ($this->fightNumber === null) {
            $this->fightNumber = FightNumber::getIt($this->getFight(), $this->getLongerWeaponlike(), $this->tables)
                ->add($this->getFightNumberModifier());
        }

        return $this->fightNumber;
    }
984010
public function getValueToUpdate()
    {
        try {
            if ($this->championship->category->isTeam()) {
                return $this->teams->map->id[0];
            }

            return $this->competitors->map->id[0];
        } catch (ErrorException $e) {
            return;
        }
    }
931194
public static function makeCollection($rows)
    {
        $collection = [];
        foreach ($rows as $row)
        {
            $obj = new static;
            $collection[] = $obj->setAttributes(get_object_vars($row));
        }
        return $collection;
    }
464398
protected function chunk(Collection $fightersByEntity)
    {
        if ($this->championship->hasPreliminary()) {
            $fightersGroup = $fightersByEntity->chunk($this->settings->preliminaryGroupSize);
            return $fightersGroup;
        }

        return $fightersByEntity->chunk($fightersByEntity->count());
    }
158447
protected function pushGroups($numRounds, $numFightersElim)
    {
        for ($roundNumber = 2; $roundNumber <= $numRounds; $roundNumber++) {
            // From last match to first match
            $maxMatches = ($numFightersElim / pow(2, $roundNumber));
            for ($matchNumber = 1; $matchNumber <= $maxMatches; $matchNumber++) {
                $fighters = $this->createByeGroup(2);
                $group = $this->saveGroup($matchNumber, $roundNumber, null);
                $this->syncGroup($group, $fighters);
            }
        }
    }
14959
public function competitorsWithBye(): Collection
    {
        $competitors = new Collection();
        $fgcs = FighterGroupCompetitor::where('fighters_group_id', $this->id)
            ->with('competitor')
            ->get();

        foreach ($fgcs as $fgc) {
            $competitors->push($fgc->competitor ?? new Competitor());
        }

        return $competitors;
    }
549659
def fight(nick, rest):
	""
	if rest:
		vtype = random.choice(phrases.fight_victories)
		fdesc = random.choice(phrases.fight_descriptions)
		# valid separators are vs., v., and vs
		pattern = re.compile('(.*) (?:vs[.]?|v[.]) (.*)')
		matcher = pattern.match(rest)
		if not matcher:
			karma.Karma.store.change(nick.lower(), -1)
			args = (vtype, nick, fdesc)
			return "/me %s %s in %s for bad protocol." % args
		contenders = [c.strip() for c in matcher.groups()]
		random.shuffle(contenders)
		winner, loser = contenders
		karma.Karma.store.change(winner, 1)
		karma.Karma.store.change(loser, -1)
		return "%s %s %s in %s." % (winner, vtype, loser, fdesc)
890750
private function winningValues()
    {
        return array_merge(
        // rows
            $this->board->getBoard(),
            // columns
            $this->transpose($this->board->getBoard()),
            // diagonals
            $this->diagonals()
        );
    }
684068
public function getAllSlotsDivided()
    {
        $return = array('radiant' => array(), 'dire' => array());
        foreach ($this->_slots as $slot) {
            $team = 'radiant';
            if ($slot->get('player_slot') > 5) {
                $team = 'dire';
            }
            array_push($return[$team], $slot);
        }
        return $return;
    }
665780
protected function getFightersByArea()
    {
        $areas = $this->settings->fightingAreas;
        $fighters = $this->getFighters();   // Get Competitor or Team Objects
        $fighterByEntity = $this->getFightersByEntity($fighters);   // Chunk it by entities (Fede, Assoc, Club,...)
        $fightersWithBye = $this->adjustFightersGroupWithByes($fighters, $fighterByEntity);     // Fill with Byes
        return $fightersWithBye->chunk(count($fightersWithBye) / $areas);   // Chunk user by areas
    }
794526
public function hasDeterminedParent()
    {
        // There is more than 1 fight, should be Preliminary
        if (count($this->fighters()) > 1) {
            return false;
        }
        foreach ($this->children as $child) {
            if (count($child->fighters()) > 1) {
                return false;
            }
        }

        return true;
    }