Example #1
0
        /// <summary>
        /// Predicts the opponents deck based on the cards they've played so far.
        /// And, initializes this agent's BlindGame object.
        /// </summary>
        /// <returns></returns>
        void PredictOpponentDeck(HearthNode state)
        {
            if (state.Game.Turn > 1 && PossibleOpponentDecks.Count != 1)
            {
                PlayedSoFar = state.GetPlayedSoFar(state.Game.CurrentOpponent);

                BlindGame = state.Game.Clone();
                Opponent  = BlindGame.CurrentOpponent;

                if (PlayedSoFar.Any(c => c.Name == "The Coin"))
                {
                    PlayedSoFar.RemoveAll(c => c.Name == "The Coin");
                }

                if (PlayedSoFar.Count == 0)
                {
                    OpponentDeck = DeckQuery.GetMostPopular(Opponent.HeroClass);
                }

                var bestMatches = new List <string>();

                if (PossibleOpponentDecks.Count == 0)
                {
                    bestMatches = DeckQuery.GetBestMatch(PlayedSoFar, Opponent.HeroClass);
                }

                else if (PossibleOpponentDecks.Count == 1)
                {
                    if (PossibleOpponentDecks[0] == OpponentDeck.Name)
                    {
                        return;
                    }

                    OpponentDeck = DeckQuery.DeckFromName(PossibleOpponentDecks[0], Opponent.HeroClass);
                }

                else
                {
                    bestMatches = DeckQuery.GetBestMatch(PlayedSoFar, Opponent.HeroClass, PossibleOpponentDecks);
                }

                if (bestMatches.Count == 1)
                {
                    PossibleOpponentDecks.Clear();
                    PossibleOpponentDecks.Add(bestMatches[0]);
                }

                else if (bestMatches.Count > 1)
                {
                    for (int i = 1; i < bestMatches.Count; ++i)
                    {
                        PossibleOpponentDecks.Add(bestMatches[i]);
                    }
                }

                OpponentDeck = DeckQuery.DeckFromName(bestMatches[0], Opponent.HeroClass);
            }
        }
Example #2
0
            void TestRemove()
            {
                testDeck = DeckQuery.DeckFromName("IceFireWarrior", CardClass.WARRIOR);

                testDeck.Remove(c => c.Name == "Fire Plume's Heart");

                var cards = new List <Card> {
                    Cards.FromName("Goldshire Footman")
                };

                testDeck.Remove(c => cards.Contains(c));
            }
Example #3
0
        /// <summary>
        /// Creates the most popular deck of the given hero class
        /// </summary>
        /// <param name="heroClass"></param>
        public Deck(CardClass heroClass)
        {
            _heroClass = heroClass;

            var deck = new Deck(DeckQuery.GetMostPopular(heroClass));

            _archetype = deck.Archetype;
            _deckName  = deck.Name;
            _numGames  = deck.NumGames;

            Clear();
            this.AddRange(deck.ToList());
        }
Example #4
0
        /// <summary>
        /// Initializes this agent's estimation of the opponent
        /// </summary>
        /// <param name="opponent"></param>
        /// <returns></returns>
        void SetupOpponent(Game game)
        {
            BlindGame     = game.Clone();
            Opponent      = BlindGame.CurrentOpponent;
            Opponent.Game = BlindGame;

            OpponentDeck     = DeckQuery.GetMostPopular(Opponent.HeroClass);
            OpponentDeckZone = new DeckZone(Opponent)
            {
                Controller = Opponent
            };

            Opponent.Deck     = OpponentDeck.Clone();
            Opponent.DeckZone = OpponentDeckZone;

            OpponentGraveyardZone = new GraveyardZone(Opponent);
            OpponentSecretZone    = new SecretZone(Opponent);

            OpponentSet = true;
        }