/// <summary>
        /// Returns a list of indexes that corresponds to the cards in the player's hand that can be played this turn as attacking cards
        /// </summary>
        /// <param name="playerHand"></param>
        /// <returns></returns>
        public override List <int> playableAttackingCards(CardLibrary.Hand playerHand)
        {
            List <int> playableCards = new List <int>();

            if (myBout.GetCardCount == 0)
            {
                for (int i = 0; i < playerHand.GetCardCount; ++i)
                {
                    playableCards.Add(i);
                }
            }
            else
            {
                for (int i = 0; i < playerHand.GetCardCount; ++i)
                {
                    bool cardAdded = false;
                    for (int j = 0; j < myBout.GetCardCount && cardAdded == false; ++j)
                    {
                        if (playerHand[i] == myBout[j])
                        {
                            playableCards.Add(i);
                            cardAdded = true;
                        }
                    }
                }
            }

            return(playableCards);
        }
        /// <summary>
        /// Returns a list of indexes that corresponds to the cards in the player's hand that can be played this turn as defending cards
        /// </summary>
        /// <param name="playerHand"></param>
        /// <returns></returns>
        public override List <int> playableDefendingCards(CardLibrary.Hand playerHand)
        {
            List <int> playableCards = new List <int>();

            if (myBout.Empty)
            {
                throw new ArgumentNullException("The bout must have a card in it to defend.");
            }
            else
            {
                CardLibrary.Card lastPlayedCard = myBout[myBout.GetCardCount - 1];

                for (int i = 0; i < playerHand.GetCardCount; ++i)
                {
                    if (playerHand[i].getSuit == lastPlayedCard.getSuit && playerHand[i] > lastPlayedCard)
                    {
                        playableCards.Add(i);
                    }
                    else if (playerHand[i].getSuit == trumpCard.getSuit && playerHand[i].getSuit != lastPlayedCard.getSuit)
                    {
                        playableCards.Add(i);
                    }
                }
            }

            return(playableCards);
        }
Exemple #3
0
 /// <summary>
 /// Returns a list of indexes that corresponds to the cards in the player's hand that can be played this turn as defending cards
 /// </summary>
 /// <param name="playerHand"></param>
 /// <returns></returns>
 public override List <int> playableDefendingCards(CardLibrary.Hand playerHand)
 {
     throw new NotImplementedException();
 }