Exemplo n.º 1
0
        public IList <ClueType> GetCluesAboutCard(CardInHand cardInHand)
        {
            var result = Player.GetCluesAboutCard(cardInHand).ToList();

            if (PossibleClue != null)
            {
                var clueAndCardMatcher = new ClueAndCardMatcher(cardInHand.Card);
                if (PossibleClue.Accept(clueAndCardMatcher))
                {
                    result.Add(PossibleClue);
                }
                else
                {
                    result.Add(PossibleClue.Revert());
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public static Clue Create(ClueType clueType, IEnumerable <CardInHand> hand)
        {
            if (clueType == null)
            {
                throw new ArgumentNullException(nameof(clueType));
            }

            var result = new List <CardInHand>();

            foreach (var cardInHand in hand)
            {
                var matcher = new ClueAndCardMatcher(cardInHand.Card);

                if (clueType.Accept(matcher))
                {
                    result.Add(cardInHand);
                }
            }

            var readOnlyCollection =
                new ReadOnlyCollectionBuilder <CardInHand>(result).ToReadOnlyCollection();

            return(new Clue(clueType, readOnlyCollection));
        }