コード例 #1
0
        /// <summary>
        /// Gimes the countries.
        /// </summary>
        public void gimecountrys(string[] countrys)
        {
            if (tesSol)
            {
                return;
            }
            for (int k = 0; (ulong)k < StringPerm.FactorialLookup(4); ++k)
            {
                StringPerm p = new StringPerm(countrys, k);
                country1 = p.element[0].ToString();
                country2 = p.element[1].ToString();
                country3 = p.element[2].ToString();
                country4 = p.element[3].ToString();



                Guy[] vizinhosArray = new Guy[5] {
                    new Guy("yellow", animal1, "Kools", 1, drink1, "Norwegian"),
                    new Guy("blue", "horse", smoke11, 2, drink2, country1),
                    new Guy(color1, animal2, smoke12, 3, "Milk", country2),
                    new Guy(color2, animal3, smoke13, 4, drink3, country3),
                    new Guy(color3, animal4, smoke14, 5, drink4, country4),
                };
                Vizinhos vizinhoslist = new Vizinhos(vizinhosArray);
                bool     val          = vizinhoslist.Valida();
                if (val == true)
                {
                    tesSol      = true;
                    Solucao[0]  = color1;
                    Solucao[1]  = color2;
                    Solucao[2]  = color3;
                    Solucao[3]  = animal1;
                    Solucao[4]  = animal2;
                    Solucao[5]  = animal3;
                    Solucao[6]  = animal4;
                    Solucao[7]  = smoke11;
                    Solucao[8]  = smoke12;
                    Solucao[9]  = smoke13;
                    Solucao[10] = smoke14;
                    Solucao[11] = drink1;
                    Solucao[12] = drink2;
                    Solucao[13] = drink3;
                    Solucao[14] = drink4;
                    Solucao[15] = country1;
                    Solucao[16] = country2;
                    Solucao[17] = country3;
                    Solucao[18] = country4;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Gime the drinks.
 /// </summary>
 public void gimedrinks(string[] drinks)
 {
     if (tesSol)
     {
         return;
     }
     for (int k = 0; (ulong)k < StringPerm.FactorialLookup(4); ++k)
     {
         StringPerm p = new StringPerm(drinks, k);
         drink1 = p.element[0].ToString();
         drink2 = p.element[1].ToString();
         drink3 = p.element[2].ToString();
         drink4 = p.element[3].ToString();
         gimecountrys(new string[] { "Spaniard", "Ukrainian", "Englishman", "Japanese" });
     }
 }
コード例 #3
0
 /// <summary>
 /// Gime the animals.
 /// </summary>
 public void gimeAnimais(string[] atoms)
 {
     if (tesSol)
     {
         return;
     }
     for (int k = 0; (ulong)k < StringPerm.FactorialLookup(4); ++k)
     {
         StringPerm p = new StringPerm(atoms, k);
         animal1 = p.element[0].ToString();
         animal2 = p.element[1].ToString();
         animal3 = p.element[2].ToString();
         animal4 = p.element[3].ToString();
         gimesmoke1(new string[] { "Parliaments", "Lucky Strike", "Chesterfield", "Old Gold" });
     }
 }
コード例 #4
0
 /// <summary>
 /// Gime the smoke1.
 /// </summary>
 public void gimesmoke1(string[] smoke1s)
 {
     if (tesSol)
     {
         return;
     }
     for (int k = 0; (ulong)k < StringPerm.FactorialLookup(4); ++k)
     {
         StringPerm p = new StringPerm(smoke1s, k);
         smoke11 = p.element[0].ToString();
         smoke12 = p.element[1].ToString();
         smoke13 = p.element[2].ToString();
         smoke14 = p.element[3].ToString();
         gimedrinks(new string[] { "Coffee", "Tea", "orange juice", "Water" });
     }
 }
コード例 #5
0
 public void gime()
 {
     if (tesSol)
     {
         return;
     }
     string[] cores = new string[] { "ivory", "Red", "Green" };
     for (int k = 0; (ulong)k < StringPerm.FactorialLookup(3); ++k)
     {
         StringPerm p = new StringPerm(cores, k);
         color1 = p.element[0].ToString();
         color2 = p.element[1].ToString();
         color3 = p.element[2].ToString();
         gimeAnimais(new string[] { "snails", "Dog", "fox", "Zebra" });
     }
 }