Exemple #1
0
        public void PlayRound()
        {
            for (var i = 0; i < _players.Count; i++)
            {
                if (_players.Count(s => s.InRound) == 0)
                {
                    break;
                }
                if (_players[i].InRound)
                {
                    _activePlayer = _players[i];

                    //play
                    PlayCard(_activePlayer);
                    var isSnap    = IsSnap;
                    var reactions = new CalculateReactions(isSnap, _players);

                    //handle reactions
                    if (reactions.Any)
                    {
                        HandleReactions(reactions);
                    }

                    //Check if round is over
                    if (IsRoundWon)
                    {
                        RoundWinner = _players.Find(g => g.InRound);
                        Console.WriteLine("Congratulations {0}! You have won this  roundofSnap!", RoundWinner.PlayerName);
                        break;
                    }
                }

                if (i == (_players.Count - 1))
                {
                    i = -1;
                }
            }
        }
Exemple #2
0
        private void HandleReactions(CalculateReactions reactions)
        {
            var fastest = reactions.FirstToReact;

            RightAlign();
            Console.WriteLine("{0} yelled SNAP!", fastest.Player.PlayerName);

            RightAlign();
            if (reactions.FirstToReact.CorrectReaction)
            {
                SuccessfulSnap(fastest.Player);
            }
            if (!fastest.CorrectReaction)
            {
                FalseSnap(fastest.Player);
            }

            StateCardsPerPlayer(); //Show latest card stats

            RightAlign();
            Console.WriteLine("Replaying in 3 seconds...");
            Thread.Sleep(3000);
        }