예제 #1
0
        /// <summary>
        /// Calculate the match rate between the deck and the cluster
        /// </summary>
        public static double Calculate(Cluster cluster, PartialDeck deck)
        {
            if (cluster.Count == 0 || deck.Count == 0)
            {
                return(1.0);
            }

            double intersectionCount = (double)cluster.Intersect(deck).Count;
            double matchRate         = intersectionCount / Math.Min(cluster.Count, deck.Count);

            return(matchRate);
        }
예제 #2
0
        /// <summary>
        /// Get the opponent deck
        /// </summary>
        private PartialDeck GetOpponentDeck(Game game)
        {
            var deck = new PartialDeck();

            foreach (var cardPlayed in game.CardHistory)
            {
                if (cardPlayed.Player == Player.Opponent &&
                    Cards.All[cardPlayed.Card.Id].Collectible)
                {
                    deck.Add(cardPlayed.Card.Id);
                }
            }

            return(deck);
        }