Skip to content

Understand the calculation and chances #4

@t1a2l

Description

@t1a2l

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;
        }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions