Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            //pierwszy wezel
            List <Wezel> lista = new List <Wezel>();
            Wezel        wierz = new Wezel(0, true);

            lista.Add(wierz);
            gen(wierz, lista);
            Console.WriteLine(lista.Count);
        }
Ejemplo n.º 2
0
        static void gen(Wezel wierz, List <Wezel> lista)
        {
            //mozliwe zetony
            int[] zetony = new int[] { 4, 5, 6 };
            if (wierz.suma > 21)
            {
                return;
            }

            foreach (int i in zetony)
            {
                Wezel dziecko = new Wezel(wierz.suma + i, !wierz.czyjRuch);
                gen(dziecko, lista);
                lista.Add(dziecko);
                wierz.dzieci.Add(dziecko);
            }
        }