Exemple #1
0
        private bool IsCardHigher(int card, int highestCard)
        {
            int suit        = BitwiseCardHelper.GetSuitAsBits(card);
            int highestSuit = BitwiseCardHelper.GetSuitAsBits(highestCard);

            if (suit == highestSuit)
            {
                return((uint)card > (uint)highestCard);
            }

            int trumpSuit = mContext.TrumpSuit;

            if (trumpSuit != 0)
            {
                if ((suit == trumpSuit) && (highestSuit != trumpSuit))
                {
                    return(true);
                }

                if ((suit != trumpSuit) && (highestSuit == trumpSuit))
                {
                    return(false);
                }
            }

            return(false);
        }
Exemple #2
0
        internal void DoMove(Move move)
        {
            // Register the move.
            ActiveHand.Move = move;
            // Remove the played card from the player's cards.
            ActiveHand.Cards &= ~move.Card;

            // Update the leading suit.
            if (mLeadingSuit == 0)
            {
                mLeadingSuit = BitwiseCardHelper.GetSuitAsBits(move.Card);
            }

            ActivateNextHand();

            // If the next player has already played a card, then the trick is over.
            if (ActiveHand.Move.Card != 0)
            {
                mActiveIndex = GetTrickWinner();
                ActiveHand.Tricks++;

                for (int i = 0; i < HandCount; i++)
                {
                    mDiscards     |= mHands[i].Move.Card;
                    mHands[i].Move = Move.Empty;
                }

                mLeadingSuit = 0;
            }
        }