/** * Returns a map CitizenUniqueIdentifier => Citizen * @return array */ protected function getCitizens() { $citizens = []; foreach ($this->population->getAllCitizenUniqueIdentifiers() as $identifier) { $citizens[$identifier] = $this->population->getCitizenByUniqueIdentifier($identifier); } return $citizens; }
/** * Get the top performers for this iteration. * If you dont specify how many you want, it will return the same number * as defined in the citizensCountToReplacePerGeneration. * * @param int|null $howMany * * @return Citizen[]|array */ protected function getTopPerformers($howMany = null) { $topPerformers = []; if ($howMany === null) { $howMany = $this->citizensCountToReplacePerGeneration; } $topPerformerIdentifiers = $this->scoreManager->getTopPerformersUniqueIdentifiers($howMany); foreach ($topPerformerIdentifiers as $identifier) { $topPerformers[] = $this->population->getCitizenByUniqueIdentifier($identifier); } return $topPerformers; }