Example #1
0
        public static void Run(
            string puzzle = "SQ1~P5", int min  = 0, int sec = 0,
            string solver = "fr!", string pool = PoolDefault,
            double minR   = 0, double maxR     = 2000)
        {
            if (min == 0 && sec == 0)
            {
                min = 3;
            }

            var pathHelper = new PathHelper();
            var compLib    = new LibraryComponent(pathHelper.GetRelDataPath("Lib"));

            var selection = compLib.GetPuzzlesWithCachingUsingRegex(puzzle).ToArray();

            if (!selection.Any())
            {
                throw new Exception($"Not puzzles found '{puzzle}', should be SQ1~P5 or SQ1, etc");
            }

            var solverRun = new SolverRun();

            solverRun.Init();
            solverRun.AddRange(
                selection
                .OrderBy(x => x.Rating)
                .Where(x => x.Rating >= minR && x.Rating <= maxR)
                );

            SolverRun(puzzle, min, sec, solver, pool, minR, maxR, solverRun);
        }
Example #2
0
        public void Run(
            string puzzle = "SQ1~P13", int min = 0, int sec = 0,
            string solver = "fr!", string pool = BatchSolveComponent.PoolDefault,
            double minR   = 0, double maxR     = 2000, string save = null)
        {
            if (min == 0 && sec == 0)
            {
                min = 3;
            }

            var pathHelper = new PathHelper();
            var compLib    = new LibraryComponent(pathHelper.GetRelDataPath("Lib"));

            var selection = compLib.GetPuzzlesWithCachingUsingRegex(puzzle).ToArray();

            if (!selection.Any())
            {
                throw new Exception($"Not puzzles found '{puzzle}', should be SQ1~P5 or SQ1, etc");
            }

            var solverRun = new SolverRun();

            solverRun.Init();
            solverRun.AddRange(
                selection
                .OrderBy(x => x.Rating)
                .Where(x => x.Rating >= minR && x.Rating <= maxR)
                );

            var batch = new BatchSolveComponent();

            batch.SolverRun(new BatchSolveComponent.BatchArgs(puzzle, min, sec, solver, pool, minR, maxR, save)
            {
                Console = new TextWriterAdapter(System.Console.Out)
            }, solverRun);
        }