Exemple #1
0
        public void ListenClue(Clue clue)
        {
            if (clue == null)
            {
                throw new ArgumentNullException(nameof(clue));
            }
            if (!clue.Type.IsStraightClue)
            {
                throw new IncorrectClueException("You can give clues only about Rank IS or Nominal IS type");
            }

            // эвристика
            if (clue.IsSubtleClue(FireworkPile.GetExpectedCards()))
            {
                Logger.Log.Info("It's a subtle clue");
                _specialCards.Add(clue.Cards.First());
            }

            _memory.Update(clue);
        }
Exemple #2
0
        public void Update(Clue clue)
        {
            if (clue == null)
            {
                throw new ArgumentNullException(nameof(clue));
            }

            foreach (CardInHand card in clue.Cards)
            {
                ApplyClue(card, clue.Type);
            }

            IEnumerable <CardInHand> otherCards = _thoughts
                                                  .Select(thought => thought.CardInHand);

            Clue revertedClue = Clue.Revert(clue, otherCards);

            foreach (CardInHand otherCard in revertedClue.Cards)
            {
                ApplyClue(otherCard, revertedClue.Type);
            }
        }
Exemple #3
0
        private void GiveClue(Player playerToClue, Clue clue)
        {
            if (playerToClue == null)
            {
                throw new ArgumentNullException(nameof(playerToClue));
            }
            if (clue == null)
            {
                throw new ArgumentNullException(nameof(clue));
            }
            if (!clue.Type.IsStraightClue)
            {
                throw new IncorrectClueException("You must say rank or color!");
            }

            playerToClue.ListenClue(clue);

            Logger.Log.Info(string.Format(
                                $"Player {Name} gives clue to player {playerToClue.Name}: {clue.Type}"));

            RaiseClueGivenEvent();
        }
Exemple #4
0
 public static Clue Revert(Clue clue, IEnumerable <CardInHand> hand)
 {
     return(Create(clue.Type.Revert(), hand));
 }