Ejemplo n.º 1
0
        /// <summary>
        /// Runs the reduction steps and returns how many common cells were found.
        /// </summary>
        /// <param name="solver">The solver to act on.</param>
        /// <returns>The number of common cells found.</returns>
        private static int ReduceAndResolve(GridSolver solver)
        {
            var foundCommonCells = solver.EvaluateCommonCells();

            Console.WriteLine($"Common cells found: {foundCommonCells}");

            solver.PrintGrid();

            var reductionSolved = solver.ReducePermutations();

            Console.WriteLine($"Rows solved by reduction: {reductionSolved}");

            var estimate = solver.BestGuessPermutations();

            Console.WriteLine($"Estimated permutations remaining: {estimate.Item1}");
            Console.WriteLine($"Rows and columns that are still guesses: {estimate.Item2}");

            solver.PrintGrid();

            return foundCommonCells;
        }