Example #1
0
        public static void Main(string[] args)
        {
            //var solver = new DepthFirstSearchSolver(NUM_ROPES, ROPE_BURN_TIME);
            var solver = new BreadthFirstSearchSolver(NUM_ROPES, ROPE_BURN_TIME);
            var allKnownTimesWithInstructions = solver.Solve();

            var summary = FormatUtilities.GetSummary(allKnownTimesWithInstructions, NUM_ROPES, ROPE_BURN_TIME);

            Console.WriteLine(summary);

            Console.WriteLine(Environment.NewLine + "Press any key for detailed instructions...");
            Console.ReadKey();

            foreach (var knownTime in allKnownTimesWithInstructions)
            {
                var humanReadableInstructions = FormatUtilities.GetHumanReadableInstructions(knownTime.Key, knownTime.Value);
                foreach (var humanReadableInstruction in humanReadableInstructions)
                {
                    Console.WriteLine(humanReadableInstruction);
                }

                Console.WriteLine();
            }
            Console.WriteLine(Environment.NewLine + "Press any key to end...");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            var puzzle   = new StarSunPuzzle();
            var solver   = new BreadthFirstSearchSolver();
            var solution = solver.Solve(puzzle);

            Console.WriteLine(puzzle);
            foreach (var(pos, dir) in solution)
            {
                Thread.Sleep(1000);
                puzzle.Move(pos, dir);
                Console.Clear();
                Console.WriteLine(puzzle);
            }
        }