Ejemplo n.º 1
0
 public void UseCards(BTCard card)
 {
     Hand.RemoveCards(new List <BTCard> {
         card
     });
     DealCardMenu.UpdateHand(Hand);
 }
Ejemplo n.º 2
0
        public PlayedCards PlayTurn(PlayedCards currentMove)
        {
            var cardsToPlay = new PlayedCards(this);

            // display the cards to the player
            DisplayCardList();

            bool valid = false;

            do
            {
                var stillBuildingHand = true;

                do
                {
                    int selectedCardIndex = GetUserSelectedCardIndex();

                    if (selectedCardIndex >= 0)
                    {
                        BTCard selectedCard = Hand[selectedCardIndex];
                        cardsToPlay.AddCard(selectedCard);
                        valid = true;
                    }

                    if (!ContinueBuildingHandPrompt())
                    {
                        stillBuildingHand = false;
                    }
                } while (stillBuildingHand);


                try
                {
                    // validate the move
                    cardsToPlay.Validate(currentMove);
                }
                catch (Exception ex)
                {
                    cardsToPlay.Clear();
                    Console.WriteLine("Invalid move: " + ex.Message);
                    valid = false;
                }
            } while (valid == false);

            // play the cards);
            return(cardsToPlay);
        }
Ejemplo n.º 3
0
        public bool IsCardPartOfStrongerHand(BTCard BTCard)
        {
            if (!this.Contains(BTCard))
            {
                throw new ArgumentOutOfRangeException("We don't have a " + BTCard.GetCardName());
            }

            // check if it's part of a pair, this return true for trips and quads as well.
            var isAtleastPair = GetSameValuedCards(BTPokerHands.Double)
                                .Any(g => g
                                     .Any(c => c.Value == BTCard.Value)
                                     );


            // todo: check if it's part of a poker hand


            // not part of stronger hand.
            return(isAtleastPair);
        }
Ejemplo n.º 4
0
 public void AddCard(BTCard BTCard)
 {
     Hand.AddCard(BTCard);
 }
Ejemplo n.º 5
0
 public bool IsGreaterThan(BTCard other)
 {
     return((GameValue == other.GameValue && Suit > other.Suit) || GameValue > other.GameValue);
 }