Exemplo n.º 1
0
        public FoldResult PlayFold(int turn)
        {
            List <Card> cardsPlayed = new List <Card>();

            for (var i = 0; i < PlayersCount; i++)
            {
                var card = _players[i].PlayCard();
                if (!_hands[i].Remove(card))
                {
                    throw new InvalidOperationException(_players[i].Name + " is a cheater!");
                }

                _logger.Log(LogLevel.Debug, card.ToString());
                cardsPlayed.Add(card);
            }

            var winnerIndex = cardsPlayed.IndexOf(cardsPlayed.Max());
            var result      = new FoldResult(cardsPlayed.AsReadOnly(), winnerIndex, turn);

            foreach (var player in _players)
            {
                player.ReceiveFoldResult(result);
            }
            _logger.Log(LogLevel.Debug, "[" + string.Join(", ", result.CardsPlayed.Select(c => c.ToString()).ToArray()) + "] => " + result.Winner);
            return(result);
        }
Exemplo n.º 2
0
 public void ReceiveFoldResult(FoldResult result)
 {
     foreach (Card c in result.CardsPlayed)
     {
         _remainingCards.Remove(c);
     }
 }
Exemplo n.º 3
0
 public void ReceiveFoldResult(FoldResult result)
 {
     _currentTurn = result.Turn;
     foreach (Card usedCard in result.CardsPlayed)
     {
         _deck.Remove(usedCard);
     }
 }
Exemplo n.º 4
0
 public void ReceiveFoldResult(FoldResult result)
 {
     foreach (Card playedCard in result.CardsPlayed)
     {
         if (!this.DealtCards.Contains(playedCard))
         {
             this.CardDeck.Remove(playedCard);
             this.DealtCards.Add(playedCard);
         }
     }
 }
Exemplo n.º 5
0
        void IPlayer.ReceiveFoldResult(FoldResult result)
        {
            for (int i = 0; i < _playerCount; i++)
            {
                if (i != _id)
                {
                    Card c = result.CardsPlayed.ToArray()[i];
                    _deck.Remove(c);
                }
            }

            CalculateProb();
        }
Exemplo n.º 6
0
 public void ReceiveFoldResult(FoldResult result)
 {
     if (_lastCard.CompareTo(result.CardsPlayed.Max()) < 0)
     {
         _turn = _cards.Count - 1;
     }
     else
     {
         _turn = _cards.Count / 2;
         if (_turn > 1)
         {
             _turn--;
         }
     }
 }
Exemplo n.º 7
0
        public void ReceiveFoldResult(FoldResult result)
        {
            _wins[result.Winner]++;
            _previousWinningCard = result.CardsPlayed.First();

            foreach (var card in result.CardsPlayed)
            {
                _playedCards.Add(card);
                _valuesPlayed[(int)card.Value]++;

                if (_previousWinningCard.CompareTo(card) < 0)
                {
                    _previousWinningCard = card;
                }
            }

            //_logger.Log(LogLevel.Warning, "Wining Card : " + _previousWinningCard.Value + " of " + _previousWinningCard.Suit);
        }
Exemplo n.º 8
0
        public void ReceiveFoldResult(FoldResult result)
        {
            foreach (Card c in result.CardsPlayed)
            {
                _valuesArray[(int)c.Value]++;

                if ((int)c.Value >= _maxIndex)
                {
                    _maxIndex = (int)c.Value;
                }

                if ((int)c.Value <= _minIndex)
                {
                    _minIndex = (int)c.Value;
                }
            }

            Moyenne();
        }
Exemplo n.º 9
0
 public void ReceiveFoldResult(FoldResult result)
 {
     foreach (var element in result.CardsPlayed)
     {
         if (_cards.Count > 0)
         {
             if (element > _cards.First())
             {
                 _betterCardPlayed++;
             }
             else if (element < _cards.Last())
             {
                 _lessCardPlayed++;
             }
             else
             {
                 _cardPlayed.Add(element);
             }
         }
     }
 }
Exemplo n.º 10
0
 public void ReceiveFoldResult(FoldResult result)
 {
     //nothing to do
 }
Exemplo n.º 11
0
 public void ReceiveFoldResult(FoldResult result)
 {
 }
Exemplo n.º 12
0
 public void ReceiveFoldResult(FoldResult result)
 {
     _enemyPowerUsed += (int)result.CardsPlayed.ToArray()[0].Value + 2;
 }
Exemplo n.º 13
0
 public void ReceiveFoldResult(FoldResult result)
 {
     lastResult = result;
 }
 public void ReceiveFoldResult(FoldResult result)
 {
     // do nothing
 }