Exemplo n.º 1
0
 private void CreateFemales()
 {
     for (int i = 0; i < femaleNames.Length; i++)
     {
         Woman w = new Woman();
         w.SetName(femaleNames[i]);
         women[i] = w;
     }
 }
Exemplo n.º 2
0
        public void pair()
        {
            Man m = GetFree(men);

            while (m != null)
            {
                Woman w = m.GetChoice();
                while (m.IsFree())
                {
                    if (w.Prefer(m))
                    {
                        w.SetEngaged(m);
                        m.ChangeStatus();
                    }
                    m.Next();
                    w = m.GetChoice();
                }
                m = GetFree(men);
            }
        }
Exemplo n.º 3
0
        private void SetMaleranks()
        {
            for (int i = 0; i < maleNames.Length; i++)
            {
                Woman[]  females = new Woman[femaleNames.Length];
                string[] rank    = maleRank[i];

                for (int j = 0; j < rank.Length; j++)
                {
                    string f = rank[j];

                    foreach (Woman w in women)
                    {
                        if (w.GetName().Equals(f))
                        {
                            females[j] = w;
                            break;
                        }
                    }
                }
                men[i].SetRank(females);
            }
        }