コード例 #1
0
        /// <summary>
        /// Constructor for the model class which gets the generator for the SearchGames and the
        /// delegate that we will use to get SearchGames from serialized strings.
        /// </summary>
        /// <param name="generator">
        /// The generator that will help us create SearchGames.
        /// </param>
        /// <param name="fromSerialized">
        /// A function that will return a SearchGame from a Serialized string.
        /// </param>
        public Model(ISearchGameGenerator generator, FromSerialized fromSerialized)
        {
            numToAlgorithm      = new Dictionary <Algorithm, ISearcher <Position> >();
            this.generator      = generator;
            cache               = new SolutionCache <string>();
            this.fromSerialized = fromSerialized;
            this.connector      = new Connector();

            // Initial numToAlgorithm
            numToAlgorithm[Algorithm.BFS] = new BFSSearcher <Position>();
            numToAlgorithm[Algorithm.DFS] = new DFSSearcher <Position>();
        }
コード例 #2
0
        /// <summary>
        /// Constructor of the Model class that gets a SearchGame generator and
        /// sets the FromSerialized by default.
        /// </summary>
        /// <param name="generator">
        /// The SearchGameGenerator that we will use to create SearchGames.
        /// </param>
        public Model(ISearchGameGenerator generator) : this(generator, str => null)
        {
            //Maybe use it later,saved here for now.
            //numToAlgorithm = new Dictionary<int, ISearcher<Position>>();
            //nameToGame = new Dictionary<string, ISearchGame>();
            ////Save the generator.
            //this.generator = generator;
            ////Create a new cache for all the solutions.
            //cache = new SolutionCache();
            //fromSerialized = str => null;

            //// initial numToAlgorithm
            //numToAlgorithm[0] = new BFSSearcher<Position>();
            //numToAlgorithm[1] = new DFSSearcher<Position>();
        }