public static void PlayAuto(int problemnum, string solution, int seed, string[] powerPhrases, int delay) { var problem = ProblemsSet.GetProblem(problemnum); var game = new Game(problem, new Output() { solution = solution, seed = problem.sourceSeeds[seed] }, powerPhrases); var emulator = new Emulator(game, delay); emulator.Run(); }
public static void PlayManual(int problemnum, int seed, string[] powerPhrases, int delay) { var problem = ProblemsSet.GetProblem(problemnum); var game = new ConsoleGame(problem, problem.sourceSeeds[seed], powerPhrases); var emulator = new Emulator(game, delay); emulator.Run(); }
public string Solve(Problem problem, int seed, string[] magicSpells) { var game = new ConsoleGame(problem, seed, magicSpells); var emulator = new Emulator(game, -1); emulator.Run(); var solution = game.Solution; return solution; }
public static void Solve(int problemnum, int seed, string[] magicSpells, int delay, bool visualize) { var problem = ProblemsSet.GetProblem(problemnum); // var solver = new MuggleProblemSolver(); var solver = SelectSolver(problem); var stopwatch = Stopwatch.StartNew(); var solution = solver.Solve(problem, problem.sourceSeeds[seed], magicSpells); stopwatch.Stop(); var game = new Game(problem, new Output { seed = problem.sourceSeeds[seed], solution = solution }, magicSpells); if (visualize) { var emulator = new Emulator(game, delay); emulator.Run(); } else { while (game.state == GameBase.State.UnitInGame || game.state == GameBase.State.WaitUnit) { game.Step(); } Console.WriteLine("Score=" + game.CurrentScore); Console.WriteLine("Time=" + stopwatch.Elapsed); Console.ReadKey(); } }