Example #1
0
    public Structure ThereIsABetterJob(Person person)
    {
        if (person.Home == null)
        {
            return(null);
        }

        if (!UPerson.IsMajor(person.Age))
        {
            return(BetterSchool(person));
        }
        return(BetterWork(person));
    }
Example #2
0
    /// <summary>
    /// Will find adults of specific Gender from the homeless list
    /// </summary>
    /// <param name="gender">Adult gender </param>
    /// <summary>
    /// Will find adults of specific Gender from the homeless list
    /// </summary>
    /// <param name="gender">Adult gender </param>
    static private List <Person> FindAdult(H gender, List <Person> homeLessP)
    {
        List <Person> res = new List <Person>();

        for (int i = 0; i < homeLessP.Count; i++)
        {
            var person = homeLessP[i];
            if (person.Gender == gender && UPerson.IsMajor(person.Age))
            {
                res.Add(person);
            }
        }
        return(res);
    }
Example #3
0
    /// <summary>
    /// Has the logic that defined if is a bbeter home
    /// </summary>
    /// <param name="person"></param>
    /// <returns></returns>
    private string DefineIfIsABetterHouse(Person person, string homeToEval, List <BuildRank> list)
    {
        if (ThereIsABetterHome(person, list))
        {
            var isAdult = UPerson.IsMajor(person.Age);

            if (isAdult)
            {
                return(DefineBetterHome4Adult(person, homeToEval));
            }
            else
            {
                return(DefineBetterHome4Child(person, homeToEval));
            }
        }
        return("");
    }
Example #4
0
    public Structure GiveWork(Person person)
    {
        var key = DecideBasedOnAge(person);
        var st  = Brain.GetStructureFromKey(key);

        //if has open positions bigger people has to Occupoied those positions bz they are for Teachers
        if (UPerson.IsWorkingAtSchool(person, st) && !UPerson.IsMajor(person.Age) && !st.HasOpenPositions())
        {
            person.IsStudent = true;
            //add to new school here
        }
        else if (UPerson.IsMajor(person.Age) && person.IsStudent)
        {
            person.IsStudent = false;
            //remove from old school here
        }
        return(st);
    }