private void TakeTurn(Player p, Game game) { var validCard = false; while (!validCard) { var cardChoiceInt = _io.GetPlayerCardChoice(p.Hand); //If user needs to draw a card for not having playable card //They choose '0' which is -1 after subtracting 1 accounting for index if (cardChoiceInt == 0) { if (game.Deck.Cards.Count > 0) { //Draw a card then set the turn so that it remains the players turn //until they draw a playable card. p.Hand.AddCards(game.DrawCardsFromDeck()); game.StayOnPlayer = true; //Though Not a valid card, this resets the turn validCard = true; } else { _io.DeckOutMessage(p); game.Deck.Cards.AddRange(p.Hand.Cards); game.Players.Remove(p); } } else { var cardChoice = p.Hand.Cards[cardChoiceInt - 1]; if (cardChoice.Color == game.DiscardPile.CurrentColor || cardChoice.Face == game.DiscardPile.topCard.Face || cardChoice.Color == Color.WILD) { validCard = true; game.DiscardPile.AddCard(cardChoice); p.Hand.Cards.Remove(cardChoice); if (cardChoice.Color == Color.WILD) { Color color = (Color)_io.ChooseWildCardColor(); game.DiscardPile.CurrentColor = color; } _logic.EvaluateCardRules(game, cardChoice, game.GetNextPlayer()); } else { _io.InvalidCardMessage(); } } } }