public Card PlayCard(GameStatus gameStatus, string myTeamName)
        {
            //Trust me, below code is bad, really bad. Wanna improve this?
            // Hints
            // 1. https://en.wikibooks.org/wiki/Card_Games/Hearts/Strategy
            // 2. http://boardgames.about.com/od/hearts/a/Basic-Hearts-Strategy.htm
            // 3. http://www.dummies.com/how-to/content/playing-hearts-game-strategies.html

            //Play random card of same suit
            var random = new Random(DateTime.Now.Millisecond);

            if (string.Compare(myTeamName, gameStatus.MyInProgressDeal.Initiator,
                StringComparison.InvariantCultureIgnoreCase) != 0) // I am not initiator
            {
                var randomCardOfSameSuit =
                    gameStatus.MyCurrentHand.Where(item => item.Suit == gameStatus.MyInProgressDeal.SuitType)
                        .OrderBy(s => random.Next())
                        .FirstOrDefault();

                if (randomCardOfSameSuit != null) return randomCardOfSameSuit;
            }

            //If this suit is not present, play random card of any other suit
            return gameStatus.MyCurrentHand.OrderBy(s => random.Next()).FirstOrDefault();
        }
        public List<Card> PassCards(GameStatus gameStatus)
        {
            //Obviously you don't want to do below, Right?
            var random = new Random(DateTime.Now.Millisecond);

            return gameStatus.MyInitialHand
                .OrderBy(item => random.Next())
                .Take(gameStatus.RoundParameters.NumberOfCardsTobePassed).ToList();
        }
        private void DoDealingActivity(GameStatus currentGameStatus)
        {
            var cardToDeal = _cardStrategy.PlayCard(currentGameStatus, _myTeamName);

            var request = new RestRequest("api/participant/playcard") { Timeout = 5000 };

            request.AddJsonBody(cardToDeal);

            var response = _proxy.Post(request);

            if (string.IsNullOrEmpty(response.Content)) return;

            var gameResponse = (CodeCompResponse)ServiceStack.Text.Json.JsonReader<CodeCompResponse>.Parse(response.Content);

            _writer.Info(
                gameResponse.HasError
                    ? gameResponse.Fault.FaultMessage
                    : string.Format("Card {0} {1} dealt successfully", cardToDeal.Suit.GetSymbol(),
                        cardToDeal.Number), true, ConsoleColor.DarkGreen);

            _writer.Info("", true);
        }
        private void DoPassingActivity(GameStatus currentGameStatus)
        {
            var noOfCardsToBePassed = currentGameStatus.RoundParameters.NumberOfCardsTobePassed;

            _writer.Info(string.Empty, true);

            _writer.Info(string.Format("{0} cards need to be passed to right.", noOfCardsToBePassed), true);

            var cardsToPass = _cardStrategy.PassCards(currentGameStatus);

            if (null != cardsToPass && cardsToPass.Count == noOfCardsToBePassed)
            {
                var request = new RestRequest("api/participant/passcards") { Timeout = 5000 };

                request.AddJsonBody(cardsToPass);

                var response = _proxy.Post(request);

                if (string.IsNullOrEmpty(response.Content)) return;

                var gameResponse = (CodeCompResponse)ServiceStack.Text.Json.JsonReader<CodeCompResponse>.Parse(response.Content);

                if (gameResponse.HasError)
                {
                    _writer.Info(gameResponse.Fault.FaultMessage, true);
                }
                else
                {
                    _writer.Info(string.Format("{0} cards passed successfully. Cards are :", noOfCardsToBePassed), true, ConsoleColor.DarkGreen);
                    foreach (Card passedCard in cardsToPass)
                        _writer.Info(string.Format("{0} {1} ", passedCard.Suit.GetSymbol(), passedCard.Number), true, passedCard.Suit.GetColor());
                }
            }

            _writer.Info(string.Empty, true);
        }
        private void DisplayMyCurrentHand(GameStatus currentGameStatus)
        {
            if (currentGameStatus.MyCurrentHand.Count > 0)
            {
                //Don't print current hand if it didn't change
                var currentHandBuilder = new StringBuilder();
                foreach (var c in currentGameStatus.MyCurrentHand)
                {
                    currentHandBuilder.AppendFormat("{0}-{1}|", c.Suit, c.Number);
                }

                var keyDisplayCurrentHand = string.Format("{0}-{1}", currentGameStatus.CurrentRoundId, currentHandBuilder.ToString());

                if (!_playerActivityTracker.ContainsKey(keyDisplayCurrentHand))
                {
                    _writer.Info("My Current Hand : ", true);

                    foreach (var card in currentGameStatus.MyCurrentHand)
                    {
                        _writer.Info(card.Suit.GetSymbol() + " " + card.Number, false, card.Suit.GetColor());
                        _writer.Info(",");
                    }

                    _writer.Info(string.Empty, true);
                    _playerActivityTracker.Add(keyDisplayCurrentHand, true);
                }
            }

            if (currentGameStatus.MyInProgressDeal.DealCards != null &&
                    currentGameStatus.MyInProgressDeal.DealCards.Count > 0)
            {
                //display current deal
                _writer.Info("Cards played so far in current deal :", true);

                foreach (var dealInfo in currentGameStatus.MyInProgressDeal.DealCards)
                    _writer.Info(dealInfo.TeamName + ":" + dealInfo.Card.Suit.GetSymbol() + " " + dealInfo.Card.Number.ToString(), true, dealInfo.Card.Suit.GetColor());
            }

            if (!string.IsNullOrWhiteSpace(currentGameStatus.MyInProgressDeal.DealWinner))
                _writer.Info(string.Format("Current Deal Winner : {0}", currentGameStatus.MyInProgressDeal.DealWinner), true);
        }