예제 #1
0
        static void RunSingleTurn3()
        {
            var statsCollector = new GameClientStatsCollector();
            var evaluator      = new Evaluator(0.876, 0.000, 0.137, 0.625, 1.000, 0.289, 0.696, 0.000, 0.522);
            AlphaBetaSearchGameClient absGameClient = new AlphaBetaSearchGameClient(evaluator, 7, statsCollector, true, true, runParallel: true);
            Player player     = new Player("AlphaBetaSearch", () => absGameClient);
            var    gameClient = player.CreateGameClient.Invoke();
            var    b          = "....." +
                                ".Ko.." +
                                ".o..." +
                                "....." +
                                "..k..";
            IEnumerable <Card> cards = new List <Card>()
            {
                Card.Elephant, Card.Monkey, Card.Cobra, Card.Frog, Card.Horse
            };
            var  cardNumbers = new[] { 0, 1, 2, 3, 4 };
            Game game        = new Game(player, null, GameUtil.ParseGameState(b, cards, 0, cardNumbers));
            Turn turn        = gameClient.GetTurn(game);

            game.PlayTurn(turn);
            Console.Out.WriteLine($"Score: {absGameClient.GameResult:0.000000}");
            Console.Out.WriteLine(AlphaBetaSearch.GetStats());
            Console.Out.WriteLine(statsCollector.GetReport());
            Console.Out.WriteLine(turn);
            Console.Out.WriteLine(game.ToString());
        }
예제 #2
0
        static void RunSingleTurn5()
        {
            var statsCollector = new GameClientStatsCollector();
            var evaluator      = new Evaluator(0.353, 0.000, 0.030, 1.000, 0.406, 0.111, 0.103, 0.000, 0.389);
            AlphaBetaSearchGameClient absGameClient = new AlphaBetaSearchGameClient(evaluator, 7, statsCollector, true, true, runParallel: false);
            Player player     = new Player("AlphaBetaSearch", () => absGameClient);
            var    gameClient = player.CreateGameClient.Invoke();
            var    b          = "...O." +
                                ".k..." +
                                "...K." +
                                "....." +
                                "o...o";
            IEnumerable <Card> cards = new List <Card>()
            {
                Card.Eel, Card.Boar, Card.Crane, Card.Rabbit, Card.Frog
            };
            var  cardNumbers = new[] { 0, 1, 2, 3, 4 };
            Game game        = new Game(player, null, GameUtil.ParseGameState(b, cards, 0, cardNumbers));
            Turn turn        = gameClient.GetTurn(game);

            game.PlayTurn(turn);
            Console.Out.WriteLine($"Score: {absGameClient.GameResult:0.000000}");
            Console.Out.WriteLine(AlphaBetaSearch.GetStats());
            Console.Out.WriteLine(statsCollector.GetReport());
            Console.Out.WriteLine(turn);
            Console.Out.WriteLine(game.ToString());
        }
예제 #3
0
        static void RunSingleTurn()
        {
            var statsCollector = new GameClientStatsCollector();
            //var evaluator = new Evaluator(1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0);
            var evaluator = new Evaluator(0.654, 1.000, 0.125, 0.674, 0.241, 0.346, 0.867, 0.554, 0.338);
            AlphaBetaSearchGameClient absGameClient = new AlphaBetaSearchGameClient(evaluator, 6, statsCollector, true, true, runParallel: true);
            Player player1    = new Player("AlphaBetaSearch", () => absGameClient);
            Player player2    = new Player("MovePawnsToBase", () => new MovePawnsToBaseGameClient());
            var    gameClient = player1.CreateGameClient.Invoke();
            var    b          = "OOK.O" +
                                "...O." +
                                "....." +
                                ".o..." +
                                "o.koo";
            IEnumerable <Card> cards = new List <Card>()
            {
                Card.Boar, Card.Ox, Card.Tiger, Card.Dragon, Card.Eel
            };
            var  cardNumbers = new[] { 0, 1, 2, 3, 4 };
            Turn turn        = gameClient.GetTurn(new Game(player1, player2, GameUtil.ParseGameState(b, cards, 0, cardNumbers)));

            Console.Out.WriteLine($"Score: {absGameClient.GameResult:0.000000}");
            Console.Out.WriteLine(AlphaBetaSearch.GetStats());
            Console.Out.WriteLine(statsCollector.GetReport());
        }
예제 #4
0
        static void RunSingleTurn4()
        {
            var statsCollector = new GameClientStatsCollector();
            var evaluator      = new Evaluator(1.000, 0.000, 0.043, 0.829, 0.654, 0.082, 0.797, 0.000, 0.437);
            AlphaBetaSearchGameClient absGameClient = new AlphaBetaSearchGameClient(evaluator, 6, statsCollector, true, true, runParallel: true);
            Player player     = new Player("AlphaBetaSearch", () => absGameClient);
            var    gameClient = player.CreateGameClient.Invoke();
            var    b          = ".O.OO" +
                                "k...K" +
                                "..o.." +
                                "....." +
                                ".o..o";
            IEnumerable <Card> cards = new List <Card>()
            {
                Card.Dragon, Card.Rooster, Card.Goose, Card.Frog, Card.Mantis
            };
            var  cardNumbers = new[] { 0, 1, 2, 3, 4 };
            Game game        = new Game(player, null, GameUtil.ParseGameState(b, cards, 0, cardNumbers));
            Turn turn        = gameClient.GetTurn(game);

            game.PlayTurn(turn);
            Console.Out.WriteLine($"Score: {absGameClient.GameResult:0.000000}");
            Console.Out.WriteLine(AlphaBetaSearch.GetStats());
            Console.Out.WriteLine(statsCollector.GetReport());
            Console.Out.WriteLine(turn);
            Console.Out.WriteLine(game.ToString());
        }