예제 #1
0
        public static List <SearchMethod> GetAvailableSearchMethodsForProblem(ExampleProblem problem)
        {
            switch (problem)
            {
            case ExampleProblem.Jug:
            case ExampleProblem.Queen4:
            case ExampleProblem.HanoiTower:
                return(new List <SearchMethod>()
                {
                    SearchMethod.TrialAndError,
                    SearchMethod.BreadthFirstSearch,
                    SearchMethod.DepthFirstSearch,
                    SearchMethod.BackTrack,
                    SearchMethod.OptimalSearch
                });

            case ExampleProblem.Cities:
                return(new List <SearchMethod>()
                {
                    SearchMethod.TrialAndError,
                    SearchMethod.BreadthFirstSearch,
                    SearchMethod.DepthFirstSearch,
                    SearchMethod.BackTrack,
                    SearchMethod.OptimalSearch,
                    SearchMethod.HillClimbing,
                    SearchMethod.AStar
                });
            }

            return(new List <SearchMethod>());
        }
예제 #2
0
        public static ISearch CreateSearch(ExampleProblem exampleProblem, SearchMethod searchMethod)
        {
            switch (exampleProblem)
            {
            case ExampleProblem.Jug:
                var problemCreator = new JugProblemCreator();
                return(GetSearch(searchMethod, problemCreator.CreateProblem()));

            case ExampleProblem.Queen4:
                var problemCreator2 = new FourQueenProblemCreator();
                return(GetSearch(searchMethod, problemCreator2.CreateProblem()));

            case ExampleProblem.HanoiTower:
                var problemCreator3 = new HanoiTowerProblemCreator();
                return(GetSearch(searchMethod, problemCreator3.CreateProblem()));

            case ExampleProblem.Cities:
                var problemCreator4 = new CitiesProblemCreator();
                return(GetSearch(searchMethod, problemCreator4.CreateProblem()));
            }

            return(null);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is ExampleProblem)
            {
                ExampleProblem exampleProblem = (ExampleProblem)value;
                switch (exampleProblem)
                {
                case ExampleProblem.Jug:
                    return("Kancsó");

                case ExampleProblem.Queen4:
                    return("Négykirálynő-probléma");

                case ExampleProblem.HanoiTower:
                    return("Hanoi tornyai");

                case ExampleProblem.Cities:
                    return("Városok");
                }
            }

            return(value);
        }