Esempio n. 1
0
        public Sorter()
        {
            parseStatistics = true;
            checkFirstLevelOnly = true;
            verbose = 0;
            reuseSolver = true;
            moveLimit = 0;
            changeLimit = 0;
            pushLimit = 0;
            boxMoveLimit = 0;
            rejectSokobanOnTarget = false;
            rejectDeadEnds = false;
            rejectCapturedTargets = false;
            normalizeLevels = true;
            validateNormalization = true;
            nodes = 20000000;
            outputFile = "LevelSorter.xsb";

            persistentSolver = reuseSolver ? Solver.CreateInstance() : null;
            set = new TransformationInvariantLevelSet();
            results = new List<LevelInfo>();

            // Don't include the sokoban in the set.
            set.IncludeSokoban = false;
        }
Esempio n. 2
0
        private void Initialize()
        {
            // Initialize the top random generator.
            if (seed == -1)
            {
                seed = new Random().Next();
            }
            topRandom = new Random(seed);

            // Initialize number of threads.
            if (threads == 0)
            {
                threads = Environment.ProcessorCount;
            }

            // Initialize results.
            results = new List<LevelInfo>();

            // Create the level set.
            set = new TransformationInvariantLevelSet();

            // Don't include the sokoban in the set.
            set.IncludeSokoban = false;

            // Create the algorithms array.
            List<AlgorithmType> algorithmList = new List<AlgorithmType>();
            foreach (AlgorithmType type in new AlgorithmType[]{ AlgorithmType.Blob, AlgorithmType.Buckshot })
            {
                if ((algorithm & type) != 0)
                {
                    algorithmList.Add(type);
                }
            }
            algorithms = algorithmList.ToArray();

            // Clear the output file.
            State state = new State();
            state.Log = new Logger(false);
            SaveResults(state);
            state.Log.Flush();
        }