Inheritance: IDisposable
Exemplo n.º 1
0
        public static void Run(TestOutput testOutput)
        {
            int gameCount = 10000;

            System.Console.WriteLine("Out of {0} games", gameCount);
            System.Console.WriteLine();

            ComparePlayers(gameCount, null, testOutput);

            System.Console.WriteLine("");
            System.Console.WriteLine("When the players have have a Silver/Silver opening, followed by Witch/Silver, Witch/Silver hands ...");
            System.Console.WriteLine("");

            ComparePlayers(gameCount,
                new CardCountPair[] {
                    new CardCountPair(Cards.Copper, 7),
                    new CardCountPair(Cards.Estate, 3),
                    new CardCountPair(Cards.Silver, 4),
                    new CardCountPair(Cards.Witch, 2),
                    new CardCountPair(Cards.Curse, 1)
                }, testOutput);

            System.Console.WriteLine("");
            System.Console.WriteLine("When the players each have a Silver/Silver opening, followed by Witch/Witch ...");
            System.Console.WriteLine("");

            ComparePlayers(gameCount,
                new CardCountPair[] {
                    new CardCountPair(Cards.Copper, 7),
                    new CardCountPair(Cards.Estate, 3),
                    new CardCountPair(Cards.Silver, 2),
                    new CardCountPair(Cards.Witch, 2)
                }, testOutput);
        }
Exemplo n.º 2
0
 public static void Run(TestOutput testOutput)
 {
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=7476.msg212934#msg212934
     testOutput.ComparePlayers("DuchyDukeWarehouseEmbassy", "BigMoney");
     testOutput.ComparePlayers("FeodumDevelop", "BigMoney");
     testOutput.ComparePlayers("DuchyDukeWarehouseEmbassy", "FeodumDevelop");
 }
Exemplo n.º 3
0
        private static void ComparePlayers(int gameCount, CardCountPair[] startingCards, TestOutput testOutput)
        {
            var gameLogFactory = new GameLogFactory();

            var player1 = Strategies.BigMoneyWithCard.Player(Cards.Witch, cardCount: 2);
            var player2 = Strategies.BigMoneyWithCard.Player(Cards.Witch, cardCount: 2);

            var builder = new GameConfigBuilder();
            builder.SetKingdomCards(player1, player2);
            if (startingCards != null)
                builder.SetStartingDeck(startingCards);

            var gameConfig = builder.ToGameConfig();

            testOutput.ComparePlayers(
                Strategies.BigMoneyWithCard.Player(Cards.Witch, cardCount: 2),
                Strategies.BigMoneyWithCard.Player(Cards.Witch, cardCount: 2),
                gameConfig,
                rotateWhoStartsFirst: true,
                numberOfGames: gameCount,
                createGameLog: new Dominion.Data.CreateGameLog(gameLogFactory.CreateGameLog));

            System.Console.WriteLine("Curses Split was Uneven {0}%", gameLogFactory.UnEvenSplitPercent);
            System.Console.WriteLine();
            System.Console.WriteLine("When the curses were not split, Player 1 won the curse split {0}/{1}", gameLogFactory.Player1WinPercent, gameLogFactory.Player2WinPercent);
        }
Exemplo n.º 4
0
 static void Run(TestOutput testOutput)
 {
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=6281.0
     testOutput.ComparePlayers("Rebuild", "BigMoney");
     //testOutput.ComparePlayers(Strategies.BigMoneyWithCard<CardTypes.Catacombs>.Player(1, 2), Strategies.BigMoney.Player(2));
     //testOutput.ComparePlayers(Strategies.BigMoneyWithCard<CardTypes.Count>.Player(1), Strategies.BigMoney.Player(2));
     testOutput.ComparePlayers(Strategies.BigMoneyWithCard.Player(Cards.HuntingGrounds), Strategies.BigMoney.Player());
 }
 static void Run(TestOutput testOutput)
 {
     // goal is to find a strategy that always beats big money.  Haven't found it yet.
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=8580.0
     //ComparePlayers(Strategies.FishingVillageChapelPoorHouseTalisman.Player(1), Strategies.BigMoney.Player(2));
     //ComparePlayers(Strategies.FishingVillageChapelPoorHouse.Player(1), Strategies.BigMoney.Player(2));
     testOutput.ComparePlayers("GardensBeggarIronworks", "BigMoney", numberOfGames: 10000);
 }
        static void FindAndCompareBestStrategy(TestOutput testOutput)
        {
            EvaulateBestStrategyForFirstGame(testOutput);
            Run();

            //FindBestStrategy currently finds the following, which is better than BigMoneySimple, but not as good as BigMoney
            //Province(1), Province, Gold, Market(1), Duchy(2), Militia(2), Silver, Estate(1),Workshop(1), Cellar(1),
        }
Exemplo n.º 7
0
 public static void Run(TestOutput testOutput)
 {
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=6623.0
     System.Console.WriteLine("Followers Cost, Player 1 Win %, Player 2 Win%, Tie%");
     for (int i = 0; i < 16; ++i)
     {
         System.Console.Write("{0}, ", i);
         testOutput.ComparePlayers(Strategies.FollowersTest.TestPlayer(i), Strategies.BigMoney.Player(), showCompactScore: true);
     }
 }
Exemplo n.º 8
0
 public static void Run(TestOutput testOutput)
 {
     var rebuildStrategy = Strategies.Rebuild.Player();
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=8391.0
     testOutput.ComparePlayers(rebuildStrategy, Strategies.BigMoney.Player());
     testOutput.ComparePlayers(rebuildStrategy, Strategies.BigMoneyWithCard.Player(Cards.Wharf, cardCount: 2));
     testOutput.ComparePlayers(rebuildStrategy, Strategies.BigMoneyWithCard.Player(Cards.Mountebank, cardCount: 2));
     testOutput.ComparePlayers(rebuildStrategy, Strategies.BigMoneyWithCard.Player(Cards.Witch, cardCount: 2));
     testOutput.ComparePlayers(rebuildStrategy, Strategies.BigMoneyWithCard.Player(Cards.YoungWitch, cardCount: 2));
 }
Exemplo n.º 9
0
 static void Main(string[] args)
 {
     using (var testOutput = new TestOutput())
     {
         var bigMoneyPlayer = Strategies.BigMoneyWithCard.Player(Cards.Magpie, playerName:"single magpie");
         foreach (PlayerAction playerAction in AllBigMoneyWithCard())
         {
             testOutput.ComparePlayers(bigMoneyPlayer, playerAction, numberOfGames: 1000, shouldParallel: true, createHtmlReport: false, createRankingReport: true, logGameCount: 0);
         }
     }
 }
        public static void Run(TestOutput testOutput)
        {
            testOutput.ComparePlayers(Strategies.BigMoney.Player(), Strategies.BigMoneyFishingVillageOverSilver.Player(2));
            testOutput.ComparePlayers(Strategies.BigMoney.Player(), Strategies.BigMoneyFishingVillageAvailableForDeckCycle.Player(2));
            testOutput.ComparePlayers(Strategies.BigMoney.Player(), Strategies.BigMoneyFishingVillageEmptyDuration.Player(2));
            testOutput.ComparePlayers(Strategies.BigMoneyFishingVillageAvailableForDeckCycle.Player(1), Strategies.BigMoneyFishingVillageEmptyDuration.Player(2));

            testOutput.ComparePlayers(Strategies.BigMoneyDoubleJack.Player(), Strategies.BigMoney.Player());
            testOutput.ComparePlayers(Strategies.BigMoneyWithSilverReplacement.Player(Cards.FishingVillage, "BigMoneyWithFishingDoubleJack", Cards.JackOfAllTrades, count: 2), Strategies.BigMoney.Player());
            testOutput.ComparePlayers(Strategies.BigMoneyDoubleJack.Player(), Strategies.BigMoneyWithSilverReplacement.Player(Cards.FishingVillage, "BigMoneyWithFishingDoubleJack", Cards.JackOfAllTrades, count: 2));
        }
 static void EvaulateBestStrategyForFirstGame(TestOutput testOutput)
 {
     //FindBestStrategy currently finds the following, which is better than BigMoneySimple, but not as good as BigMoney
     //Province(1), Province, Gold, Market(1), Duchy(2), Militia(2), Silver, Estate(1),Workshop(1), Cellar(1),
     var player1 = new PlayerAction("Player 1",
         new CardPickByPriority(
             CardAcceptance.For(Cards.Province),
             CardAcceptance.For(Cards.Gold),
             CardAcceptance.For(Cards.Market, gameState => Strategy.CountAllOwned(Cards.Market, gameState) < 1),
             CardAcceptance.For(Cards.Duchy, gameState => Strategy.CountAllOwned(Cards.Duchy, gameState) < 2),
             CardAcceptance.For(Cards.Militia, gameState => Strategy.CountAllOwned(Cards.Militia, gameState) < 2),
             CardAcceptance.For(Cards.Silver),
             CardAcceptance.For(Cards.Estate, gameState => Strategy.CountAllOwned(Cards.Militia, gameState) < 1)
             ));
     testOutput.ComparePlayers(player1, Strategies.BigMoneySimple.Player(), showVerboseScore: true);
     testOutput.ComparePlayers(player1, Strategies.BigMoney.Player(), showVerboseScore: true);
     testOutput.ComparePlayers(player1, Strategies.BigMoneySingleSmithy.Player(), showVerboseScore: true);
 }
Exemplo n.º 12
0
        static void FindOptimalPlayForEachCardWithBigMoney()
        {
            PlayerAction bigMoneyPlayer = Strategies.BigMoney.Player();
            using (var htmlRender = new HtmlRenderer.DeferredHtmlGenerator())
            using (var testoutput = new TestOutput())
            {
                foreach (Card card in Dominion.Strategy.MissingDefaults.FullyImplementedKingdomCards())
                {
                    var playerAction = StrategyOptimizer.FindBestBigMoneyWithCardVsStrategy(bigMoneyPlayer, card, logProgress:false);
                    var results = Dominion.Data.StrategyComparison.Compare(playerAction, bigMoneyPlayer, shouldParalell: true);
                    htmlRender.AddResults(results, TestOutput.GetOutputFilename);

                    System.Console.WriteLine("Before Optimization");
                    testoutput.ComparePlayers(Strategies.BigMoneyWithCard.Player(card), bigMoneyPlayer, createHtmlReport: false);
                    System.Console.WriteLine("After Optimization");
                    testoutput.ComparePlayers(playerAction, bigMoneyPlayer, createHtmlReport:false);
                }
            }
        }
Exemplo n.º 13
0
        static void Main()
        {
            using (var testOutput = new TestOutput())
            {
                var player1 = Strategies.BigMoney.Player();
                var player2 = Strategies.Miser.Player();

                var builder = new GameConfigBuilder();
                builder.CardSplit = StartingCardSplit.Split43;
                builder.SetKingdomCards(player1, player2);

                testOutput.ComparePlayers(
                    new PlayerAction[] { player1, player2},
                    builder.ToGameConfig(),
                    rotateWhoStartsFirst:true,
                    createHtmlReport: true,
                    numberOfGames: 1000,
                    shouldParallel: false);
            }
        }
        public static void Run(TestOutput testOutput)
        {
            GameConfig gameConfig = GameConfigBuilder.Create(
                StartingCardSplit.Split43,
                Cards.Bishop,
                Cards.FarmingVillage,
                Cards.GrandMarket,
                Cards.Hamlet,
                Cards.Hoard,
                Cards.Monument,
                Cards.Mountebank,
                Cards.PhilosophersStone,
                Cards.ScryingPool,
                Cards.Vineyard
                );

            testOutput.ComparePlayers(Strategies.MountebankMonumentHamletVineyard.Player(), Strategies.BigMoney.Player(), gameConfig);
            testOutput.ComparePlayers(Strategies.MountebankHoard.Player(), Strategies.BigMoney.Player(), gameConfig);
            testOutput.ComparePlayers(Strategies.MountebankMonumentHamletVineyard.Player(), Strategies.MountebankHoard.Player(), gameConfig);
        }
        // forum post:  http://forum.dominionstrategy.com/index.php?topic=9602.0
        /*  any attempt to get more than one remake, or more than 2 sooth sayers results in a loss ....  (but in real game, the plan was 3 remakes and 3 soothsayers ...)
         *
         *
         * */
        public static void Run(TestOutput testOutput)
        {
            GameConfig gameConfig = GameConfigBuilder.Create(
                StartingCardSplit.Split43,
                Cards.Butcher,
                Cards.GreatHall,
                Cards.HornOfPlenty,
                Cards.HorseTraders,
                Cards.Minion,
                Cards.Pawn,
                Cards.Remake,
                Cards.Soothsayer,
                Cards.StoneMason,
                Cards.Swindler
                );

            //testOutput.ComparePlayers(Strategies.HorseTraderSoothsayerMinionGreatHall.Player(1), Strategies.HorseTraderSoothsayerMinionGreatHall.Player(2, false), gameConfig);
            testOutput.ComparePlayers(Strategies.HorseTraderSoothsayerMinionGreatHall.Player(), Strategies.BigMoney.Player(), gameConfig);
            testOutput.ComparePlayers(Strategies.RemakeSoothsayer.Player(), Strategies.BigMoney.Player(), gameConfig);
            testOutput.ComparePlayers(Strategies.RemakeSoothsayer.Player(), Strategies.HorseTraderSoothsayerMinionGreatHall.Player(), gameConfig);
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            using (var testOutput = new TestOutput())
            {
                var playerAction = Strategies.BigMoneyWithCard.Player(Cards.Magpie, cardCount:2, playerName: "DoubleMagpie");
                foreach (PlayerAction otherPlayerAction in BuiltInStrategies.StrategyLoader.GetAllPlayerActions())
                {
                    if (playerAction == otherPlayerAction)
                        continue;

                    testOutput.ComparePlayers(
                        playerAction,
                        otherPlayerAction,
                        shouldParallel: true,
                        logGameCount: 0,
                        debugLogs: false,
                        numberOfGames: 1000,
                        useColonyAndPlatinum: true,
                        createHtmlReport: false,
                        createRankingReport: true);
                }
            }
        }
Exemplo n.º 17
0
 public static void Run(TestOutput testOutput)
 {
     // for forum topic: http://forum.dominionstrategy.com/index.php?topic=8461.0
     testOutput.ComparePlayers(Strategies.BigMoneyWithCard.Player(Cards.Soothsayer), Strategies.BigMoneyWithCard.Player(Cards.Witch));
 }
 public static void Run(TestOutput testOutput)
 {
     testOutput.ComparePlayers("RebuildAdvanced", "RebuildAdvanced", startingDeckPerPlayer: StartingDecksForRebuildWithEstateAdvantage.StartingDecks);
 }