Пример #1
0
        //This method MUST be called by all children in their playCard method.
        public Boolean isLegalMove(Trick currentTrick, Card attemptedPlay)
        {
            Boolean isLegal = true;

            //If this card is not already onsuit, must check tobe sure hand has no onsuit cards in it
            if (!currentTrick.onSuitCheck(attemptedPlay))
            {
                for (int i = 0; i < hand.Count; i++)
                {
                    //So, one of the cards in the hand is the attemptedPlay, and we need to ignore that one
                    //Otherwise, as soon as you find an onsuit card elsewhere, this play is illegal
                    if (currentTrick.onSuitCheck((Card)hand[i]) == true && hand[i] != attemptedPlay)
                    {
                        isLegal = false;
                    }
                }
            }
            return(isLegal);
        }