Esempio n. 1
0
        public void Setup()
        {
            SetRandom(164);
            var relics  = GetRandomRelics(3);
            var potions = GetRandomPotions(2);
            var enemyHp = 100;

            _Player = new Player(hp: 80, relics: relics, potions: potions);
            _Enemy  = new Cultist(enemyHp);
            //var hand = gsl("Strike", "Strike", "Strike", "Strike", "Strike", "Defend", "Defend", "Defend", "Defend", "Bash","WildStrike","PommelStrike+");
            var cis = GetRandomCards(10);

            cis.Add(Helpers.GetCi("Armaments"));
            cis.Add(Helpers.GetCi("Armaments"));
            cis.Add(Helpers.GetCi("Armaments+"));
            cis.Add(Helpers.GetCi("TrueGrit"));
            Console.WriteLine("Deck: " + SJ(separator: ' ', cis.OrderBy(el => el.Card.Name)));
            var deck = new Deck(cis);

            deck.InteractiveContext = true;
            _Fight           = new Fight(deck, _Player, _Enemy);
            _Root            = new FightNode(_Fight);
            _Current         = _Root;
            _Fight.FightNode = _Root;
            _Fight.StartFight();
        }
Esempio n. 2
0
        /// <summary>
        /// Only need to copy the specific fields.
        /// </summary>
        public override IEnemy Copy()
        {
            var res = new Cultist();

            CopyEntity(res);
            return(res);
        }
Esempio n. 3
0
        public static void TestCultistMC()
        {
            var turnNumber = 0;

            var initialDeck = new List <string>()
            {
                "Strike", "Strike", "Strike", "Strike", "Strike", "Defend", "Defend", "Defend", "Defend", "Bash"
            };
            //initialHand.AddRange(new List<string>() {"Pummel", "Exhume"});

            var hand        = gsl();
            var drawPile    = initialDeck;
            var exhaustPile = gsl();
            var discardPile = gsl();
            var enemyHp     = 51;
            var playerHp    = 1;
            var firstDraw   = new List <string>()
            {
                "Strike", "Strike", "Defend", "Defend", "Bash"
            };
            var statuses = new List <StatusInstance>()
            {
            };

            if (false)
            {
                turnNumber  = 1;
                discardPile = firstDraw;
                drawPile    = gsl("Strike", "Strike", "Defend", "Defend", "Strike");
                firstDraw   = gsl("Strike", "Strike", "Defend", "Defend", "Strike");
                statuses    = new List <StatusInstance>()
                {
                    GS(new Feather(), 3), GS(new Vulnerable(), 1)
                };
            }

            var enemy = new Cultist(hp: enemyHp);

            enemy.StatusInstances = statuses;
            var player = new Player(hp: playerHp);

            var deck = new Deck(drawPile, hand, discardPile, exhaustPile);

            var mc        = new MonteCarlo(deck, enemy, player, turnNumber, firstDraw);
            var bestValue = new NodeValue(-100, 0, null);

            for (var ii = 0; ii < 100000; ii++)
            {
                var leaf  = mc.MC(mc.Root.Randoms.First());
                var value = leaf.GetValue();
                if (value > bestValue)
                {
                    bestValue = value;
                    SaveLeaf(leaf, ii);
                    ShowInitialValues(mc.Root.Randoms.First());
                }
            }

            System.IO.File.AppendAllText(Output, $"==========Final First move best lines");
            ShowInitialValues(mc.Root.Randoms.First());
            SaveAllLeaves(mc.Root);
        }