Beispiel #1
0
        static void Main(string[] args)
        {
            table tx = null;

            Console.Write("enter rows or press enter\n");
            string[] input = new string[3];
            input[0] = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input[0]))
            {
                tx = new table();
            }
            else
            {
                input[2] = Console.ReadLine();
                input[1] = Console.ReadLine();
                tx       = new table(input);
                Console.WriteLine();
            }
            Console.WriteLine("table: ");
            tx.PrintStdOut();
            TraverseTable(tx);
            Console.WriteLine();
            Console.WriteLine("result:");
            Console.WriteLine(tx.DumpHistoryNum());
            // метод формирования максимального числа из пройденых не уточнен, вот два
            Console.WriteLine(tx.DumpHistoryNumSorted());
            Console.WriteLine(tx.DumpHistoryNumSortedString());
        }
Beispiel #2
0
        static void TraverseTable(table t)
        {
            while (true)
            {
                int[] steps = t.GetAvailableSteps().ToArray();
                if (steps.Length == 0)
                {
                    break;
                }

                int sel = steps[0];
                t.MakeStep(sel);
            }
        }