Example #1
0
        public virtual ISuit SecondRoundTrumpChoice(IGameState gameState)
        {
            //if I have at least 3 trump of any suit, order up if the sum of the ranks over a certain amt
            var validSuits = CardHelper.GetSuitsToChooseFrom(gameState.TurnedUpCard.Suit);

            var   rankTotal     = 0;
            ISuit suitToOrderUp = null;

            foreach (var suit in validSuits)
            {
                var suitRankTotal = gameState.CurrentPlayer.Cards.Where(x => x.Suit == suit).Sum(x => x.Rank.Value);
                var thisSuit      = suit;

                //provide a boost for any bowers
                if (CardHelper.ContainsLeft(suit, gameState.CurrentPlayer.Cards))
                {
                    suitRankTotal += 4;
                }

                if (CardHelper.ContainsRight(suit, gameState.CurrentPlayer.Cards))
                {
                    suitRankTotal += 5;
                }

                if (suitRankTotal > 43 && suitRankTotal > rankTotal)
                {
                    rankTotal     = suitRankTotal;
                    suitToOrderUp = suit;
                }
            }

            return(suitToOrderUp);
        }
Example #2
0
        public void ContainsRight(int handId, int trumpSuitId, bool expectedResult)
        {
            var cards     = _getCards(handId).OrderBySuitsAndRanks();
            var trumpSuit = _getSuit(trumpSuitId);

            _dumpCardsToConsole(cards);

            var result = CardHelper.ContainsRight(trumpSuit, cards);

            Assert.AreEqual(result, expectedResult);
        }