public ISolutionFinderStrategy GetSolutionFinderStrategy(SolutionStrategyTypes solutionStrategyTypes) { ISolutionFinderStrategy solutionFinderStrategy; switch (solutionStrategyTypes) { case SolutionStrategyTypes.RandomSolutionStrategy: solutionFinderStrategy = new RandomSolution(randomSolutionGenerator); break; case SolutionStrategyTypes.EVOSolutionStrategy: solutionFinderStrategy = new EvolutionarySolution(randomSolutionGenerator, parentSelection, recombination, bestSolutionFinder, mutation, solutionEvaluator, adptiveChanceAdjuster); break; case SolutionStrategyTypes.GenerateTestResults: solutionFinderStrategy = new ResultsCreator(bestSolutionFinder, new EvolutionarySolution(randomSolutionGenerator, parentSelection, recombination, bestSolutionFinder, mutation, solutionEvaluator, adptiveChanceAdjuster), csvFileWriter); break; default: solutionFinderStrategy = new RandomSolution(randomSolutionGenerator); break; } return(solutionFinderStrategy); }
private void InitAI() { MoveMaker myStrategy = null; EvaluationFunction eval = null; UtilityFunction ufunc = null; //////////////// // your code here to initialize the MinMax algorithm // 1. Evaluation function // 2. Utility function // 3. Strategy (MinMax and MinMax Alpha Beta) /////////////// switch (evalfunc) { case EvaluatationFunc.Eval: eval = new EvaluationFunction(); break; default: Debug.Log("Not an option"); break; } switch (utilfunc) { case UtilityFunc.Util: ufunc = new UtilityFunction(); break; default: Debug.Log("Not an option"); break; } switch (strategy) { case TypeStrategy.RandomStrategy: myStrategy = new RandomSolution(this, GameManager.instance.GetAdversary(this)); break; case TypeStrategy.MinMax: myStrategy = new MinMaxAlgorithm(this, eval, ufunc, GameManager.instance.GetAdversary(this)); break; default: Debug.Log("Not an option"); break; } moveMaker = myStrategy; }