示例#1
0
        public void EndGame()
        {
            Output.WriteLine($"The game has ended. {Environment.NewLine}");
            var winner = Players.Aggregate((p1, p2) => p1.DrawPile.Cards.Count > p2.DrawPile.Cards.Count ? p1 : p2);

            Output.WriteLine($"{winner.Nick} wins the game");
        }
示例#2
0
        public void CheckIfBurnBlocksSuit(Burn burn)
        {
            var suit            = burn.Card.GetSuit();
            var number          = burn.Card.GetNumber();
            var currentProgress = Progress[suit];

            if (IsReadyForBurn(burn.Card))
            {
                return;
            }

            var unplayedCards = Deck.GetRemainingCards();

            unplayedCards = Players.Aggregate(unplayedCards, (current, player) => current.Concat(player.GetHand()));
            if (unplayedCards.Any(card => card.GetSuit() == suit && card.GetNumber() == number))
            {
                return;
            }

            blockedSuitCount++;
            PushUndoable(delegate()
            {
                blockedSuitCount--;
            });
        }
示例#3
0
 void CalculateWinner()
 {
     Winner          = Players.Aggregate((p1, p2) => p1.Points > p2.Points ? p1 : p2);
     Winner.IsWinner = true;
 }
 public string ListPlayers()
 {
     return(Players.Aggregate("",
                              (current, player) =>
                              current + (player.Name + Environment.NewLine)));
 }