示例#1
0
文件: Guy.cs 项目: ruinalmeida/Zebra
        public Vizinhos(Guy[] pArray)
        {
            _vizinhos = new Guy[pArray.Length];

            for (int i = 0; i < pArray.Length; i++)
            {
                _vizinhos[i] = pArray[i];
            }
        }
示例#2
0
文件: Guy.cs 项目: ruinalmeida/Zebra
 public VizinhosEnum(Guy[] list)
 {
     _vizinhos = list;
 }
示例#3
0
文件: Guy.cs 项目: ruinalmeida/Zebra
        /// <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;

                }

            }
        }