BoostHungry / SeniorCitizenCenterMod

The Senior Citizen Center Mod for Cities Skylines is a mod that enables functionality for Nursing Home Assets. This mod is required when downloading Nursing Home Assets for Cities Skylines that reference this mod otherwise the Assets will not function properly.
2 stars 4 forks source link

Understand the calculation and chances #4

Open t1a2l opened 2 years ago

t1a2l commented 2 years ago

Hey, @BoostHungry I want to understand this average calculation better:

private static float getAgeChanceValue(uint[] familyWithSeniors) { float averageSeniorsAge = MoveInProbabilityHelper.getAverageAgeOfSeniors(familyWithSeniors); float chanceValue = ((averageSeniorsAge - (Citizen.AGE_LIMIT_ADULT - 15)) / SENIOR_AGE_RANGE) * AGE_MAX_CHANCE_VALUE; Logger.logInfo(LOG_CHANCES, "MoveInProbabilityHelper.getAgeChanceValue -- Age Chance Value: {0} -- Average Age: {1} -- ", chanceValue, averageSeniorsAge); return Math.Min(chanceValue, AGE_MAX_CHANCE_VALUE); }

And also this chances thing:

` float chance = FAMILY_STATUS_MAX_CHANCE_VALUE;

        // Make sure not to leave children alone
        if (hasChildren && !hasAdults) {
            Logger.logInfo(LOG_CHANCES, "MoveInProbabilityHelper.getFamilyStatusChanceValue -- Don't leave children alone");
            return NO_CHANCE;
        }

        // If adults live in the house, 75% less chance for this factor
        if (hasAdults) {
            chance -= FAMILY_STATUS_MAX_CHANCE_VALUE * 0.75f;
        }

        // If more than one senior, 25% less chance for this factor
        if (numSeniors > 1) {
            chance -= FAMILY_STATUS_MAX_CHANCE_VALUE * 0.25f;
        }`