Beispiel #1
0
        static void Main(string[] args)
        {
            var environment = new PuzzleEnvironment <int>(GetEightPuzzleBoard());

            var bfs = new BreadthFirstStrategy <ProblemState <int>, ProblemAction>();

            var ucs = new UniformCostStrategy <ProblemState <int>, ProblemAction>();

            var ucs2 = new UniformCostStrategy2 <ProblemState <int>, ProblemAction>();

            var dfs = new DepthFirstStrategy <ProblemState <int>, ProblemAction>();

            var dls = new DepthLimitedStrategy <ProblemState <int>, ProblemAction>(10);

            var ids = new IterativeDeepeningStrategy <ProblemState <int>, ProblemAction>();

            var greedy = new GreedyBestFirstStrategy <ProblemState <int>, ProblemAction>(
                HeuristicFunctions.StraightLineDistance);

            var astar = new AStarStrategy <ProblemState <int>, ProblemAction>(
                HeuristicFunctions.StraightLineDistance);

            var agent = new SearchAgent <int>(astar);

            RunAgent(environment, agent);
        }
Beispiel #2
0
        static int Main(string[] args)
        {
            try
            {
                char playerKey;
                string outputLocation;
                string inputMap;
                if (args == null || args.Length == 0)
                {
                    playerKey = 'A';
                    outputLocation = Path.Combine(@"C:\Users\hennie.brink\Desktop\Bomberman\Game\", playerKey.ToString());
                    inputMap =
                        File.ReadAllText(@"C:\Users\hennie.brink\Desktop\Bomberman\Replays\259502815\10\A\state.json");
                }
                else
                {
                    playerKey = Char.Parse(args[0]);
                    outputLocation = args[1];
                    inputMap = File.ReadAllText(Path.Combine(outputLocation, @"state.json"));
                }

                var map = GameMap.FromJson(inputMap);
                var gameStrategy = new AStarStrategy();

                var command = gameStrategy.ExecuteStrategy(map, playerKey);

                Console.WriteLine("Sending Back command " + command);
                File.WriteAllText(Path.Combine(outputLocation, "move.txt"), (outputLocation));

                return 0;
            }
            catch (Exception ex)
            {
                Console.Write(ex);

                return -1;
            }
        }