private static void Main(string[] args)
        {
            Helper.Setup();

            while ((maze = TestMazeFactory.GetNext()) != null)
            {
                Helper.PrintHeading("Minimal Distances In The Labytinth Of Doom");

                Helper.WriteLine("Labyrinth Before: ", ConsoleColor.DarkCyan);
                PrintLabyrinth(maze);
                Console.WriteLine();

                unexploredPositions = new Queue <MatrixPosition>();
                DoNextLabyrinth();

                Helper.WriteLine("Labyrinth After: ", ConsoleColor.DarkGreen);
                PrintLabyrinth(maze);
                Console.WriteLine();

                Helper.WriteLine("Press a key to test the next labyrinth...", ConsoleColor.DarkRed);
                Console.ReadKey(true);
                Console.Clear();
            }

            Helper.WriteLine(
                "Completed!!!",
                ConsoleColor.DarkGreen);
        }
        private static void Main(string[] args)
        {
            ConsoleMio.Setup();

            while ((maze = TestMazeFactory.GetNext()) != null)
            {
                ConsoleMio.PrintHeading("Task 14 Minimal Distances In The Labyrinth Of Doom");

                ConsoleMio.WriteLine("Labyrinth Before: ", DarkCyan);
                PrintLabyrinth(maze);
                ConsoleMio.WriteLine();

                unexploredPositions = new LinkedQueue <MatrixPosition>();
                DoNextLabyrinth();

                ConsoleMio.WriteLine("Labyrinth After: ", DarkGreen);
                PrintLabyrinth(maze);
                ConsoleMio.WriteLine();

                ConsoleMio.WriteLine("Press a key to test the next labyrinth...", DarkRed);
                Console.ReadKey(true);
                Console.Clear();
            }

            ConsoleMio.WriteLine(
                "Completed!!! Thank you very much for looking all the tasks!",
                DarkGreen);
        }
        private static void Main()
        {
            ConsoleMio.PrintHeading("Homework: OOP Principles - Part 2 - Shapes");

            while (true)
            {
                ConsoleMio.Setup();
                Prompt();
            }
        }
        private static void Main()
        {
            Console.Setup();

            Console.PrintHeading("Task 1 Iteration Simulation ");

            Console.Write("Enter n: ", DarkCyan);
            n          = int.Parse(Console.ReadLine(Gray));
            collection = new int[n];

            var iterator = new RecursionIterator(n);

            iterator.Iterate(IterationAction);
        }
Beispiel #5
0
        private static void Main()
        {
            Console.Setup();

            Console.PrintHeading("Task 4 Permutations of numbers");

            ResultPrinter printer = new ResultPrinter(Console);

            int[] collection = { 1, 2, 3, 4 };

            int subsetSize = 4;

            CombinatoricsGen <int> combo = new PermutationsGenerator <int>(subsetSize, collection);

            printer.DispalyResults(collection, collection.Length, combo);
        }
        private static void Main()
        {
            Console.Setup();

            Console.PrintHeading("Task 5 Print Ordered Subsets of K from Set of N");

            string[] mainSet = { "hi", "a", "b" };

            int subsetLength = 2;

            var printer = new ResultPrinter(Console);

            CombinatoricsGen <string> combo = new PermutationsWithRepetition <string>(subsetLength, mainSet);

            printer.DispalyResults(mainSet, subsetLength, combo);
        }
        private static void Main(string[] args)
        {
            Mio.Setup();

            Mio.PrintHeading("Task 10 Shortest Sequence Of Operations From N to M");

            Mio.Write("Enter number N = ", Black);
            int n = int.Parse(Mio.ReadLine(Red));

            Mio.Write("Enter number M = ", Black);
            int m = int.Parse(Mio.ReadLine(Red));

            // Using the stack from Task 12
            Stack <int> steps = new Stack <int>();

            steps.StackUp(m);

            int current = m;

            while (current > n)
            {
                if (current % 2 == 0 && current / 2 >= n)
                {
                    current /= 2;
                    steps.StackUp(current);
                }
                else if (current - 2 >= n)
                {
                    current -= 2;
                    steps.StackUp(current);
                }
                else if (current - 1 >= n)
                {
                    current -= 1;
                    steps.StackUp(current);
                }
            }

            Mio
            .Write("Result: ", DarkGreen)
            .WriteLine(string.Join(" → ", steps), DarkBlue);
        }
Beispiel #8
0
        private static void Main()
        {
            Console.Setup();
            Console.PrintHeading("Task 2 Generate All Combinations With Duplicates");

            int[] collection             = { 1, 2, 3, 4, 5 };
            int   combinationSetsLength  = 2;
            CombinatoricsGen <int> combo =
                new CombinatoricsesWithDuplicates <int>(combinationSetsLength, collection);

            var resultPrinter = new ResultPrinter(Console);

            resultPrinter.DispalyResults(collection, combinationSetsLength, combo);

            Console.PrintHeading("Task 3 Generate All Regular Combinations");

            combo = new CombinatoricsesRegular <int>(combinationSetsLength, collection);

            resultPrinter.DispalyResults(collection, combinationSetsLength, combo);
        }