Exemplo n.º 1
0
        public string doAction(CardContext context)
        {
            context.setCardState(this);
            //Console.WriteLine("This Soft hands");
            //Console.WriteLine("My first Card is:{0} and my Second card is:{1}", this.myCard1.getCardName(), this.myCard2.getCardName());
            //Console.WriteLine("My Dealer Card is:{0}", this.dealerCard.getCardName());
            int myCardVules     = myCard1.CardValue + myCard2.CardValue;
            int dealerCardValue = dealerCard.CardValue;
            //test for Ace
            var myAceCard   = (myCard1.TheCardType == Card.CardType.Ace) ? myCard1 : myCard2;
            var myValueCard = (myCard1.TheCardType != Card.CardType.Ace) ? myCard1 : myCard2;

            if (myValueCard.CardValue >= 8 || myValueCard.CardValue <= 10)
            {
                handActhion = new Stick();
                //Console.WriteLine("Your Soft Hand value is: {0}, Always Stick on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Stick on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else if ((myValueCard.CardValue == 2) && dealerCardValue == 6)
            {
                handActhion = new DoubleDown();
                //Console.WriteLine("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else if ((myValueCard.CardValue == 3) && dealerCardValue == 5 && dealerCardValue <= 6)
            {
                handActhion = new DoubleDown();
                Console.WriteLine("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else if ((myValueCard.CardValue == 4 || myValueCard.CardValue == 5) && dealerCardValue >= 4 && dealerCardValue <= 6)
            {
                handActhion = new DoubleDown();
                // Console.WriteLine("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else if ((myValueCard.CardValue == 6 || myValueCard.CardValue == 7) && (dealerCardValue >= 3 && dealerCardValue <= 6))
            {
                handActhion = new DoubleDown();
                // Console.WriteLine("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Double Down on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else if ((myValueCard.CardValue == 7) && dealerCardValue == 2 && dealerCardValue == 7 && dealerCardValue == 8)
            {
                handActhion = new Stick();
                // Console.WriteLine("Your Soft Hand value is: {0}, Always Stick on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Stick on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            else
            {
                handActhion = new Hit();
                Console.WriteLine("Your Soft Hand value is: {0}, Always Hit on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Stick on a {1} and {2}  ", myCardVules, myAceCard.getCardName(), myValueCard.getCardName());
            }
            return(actionMssg);
        }
Exemplo n.º 2
0
        public string doAction(CardContext context)
        {
            context.setCardState(this);
            //Console.WriteLine("This the Pairs hands");
            //Console.WriteLine("My first Card is:{0} and my Second card is:{1}", this.myCard1.getCardName(), this.myCard2.getCardName());
            //Console.WriteLine("My Dealer Card is:{0}", this.dealerCard.getCardName());

            int myCardVules     = myCard1.CardValue + myCard2.CardValue;
            int dealerCardValue = dealerCard.CardValue;

            //test for Ace

            if (myCard1.TheCardType == Card.CardType.Ace)
            {
                handActhion = new Split();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on pare of  {1} {2}  ", myCardVules, myCard1.getCardName(), myCard2.getCardName());
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on pare of  {1} {2}  ", myCardVules, myCard1.getCardName(), myCard2.getCardName());
            }
            else if ((myCard1.CardValue == 2 || myCard1.CardValue == 3) && dealerCardValue >= 4 && dealerCardValue <= 6)
            {
                handActhion = new Split();
                // Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if ((myCard1.CardValue == 5) && dealerCardValue >= 2 && dealerCardValue <= 9)
            {
                handActhion = new DoubleDown();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always Double Down on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always Double Down on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if ((myCard1.CardValue == 6) && dealerCardValue >= 2 && dealerCardValue <= 6)
            {
                handActhion = new Split();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if ((myCard1.CardValue == 7) && dealerCardValue >= 2 && dealerCardValue <= 7)
            {
                handActhion = new Split();
                Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if (myCard1.CardValue == 8)
            {
                handActhion = new Split();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if ((myCard1.CardValue == 9) && (dealerCardValue >= 8 && dealerCardValue <= 9) && dealerCardValue >= 2 && dealerCardValue <= 6)
            {
                handActhion = new Split();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always SPlit on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if ((myCard1.CardValue == 9) && (dealerCardValue >= 10 || dealerCardValue == 7))
            {
                handActhion = new Stick();
                //Console.WriteLine("Your Pair Hands value is: {0}, Always Stick on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always Stick on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
            }
            else if (myCard1.CardValue == 10)
            {
                var RoyalCheck       = (myCard1.TheCardType != Card.CardType.Regurlar) ? myCard1.royalCardName(myCard1.TheCardType) : myCard1.getCardName();
                var DealerRoyalCheck = (myCard1.TheCardType != Card.CardType.Regurlar) ? myCard1.royalCardName(myCard1.TheCardType) : myCard1.getCardName();
                handActhion = new Stick();
                // Console.WriteLine("Your Pair Hands value is: {0}, Always Stick on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, myCard1.getCardName(), myCard2.getCardName(), dealerCardValue);
                actionMssg = string.Format("Your Pair Hands value is: {0}, Always Stick on a pare of  {1} {2}  vs Dealer card of {3}", myCardVules, RoyalCheck, RoyalCheck, DealerRoyalCheck);
            }
            else
            {
                handActhion = new Hit();
                // Console.WriteLine("Your Soft Hand value is: {0}, Always Hit on a pare of  {1} {2}  ", myCardVules, myCard1.getCardName(), myCard2.getCardName());
                actionMssg = string.Format("Your Soft Hand value is: {0}, Always Hit on a pare of  {1} {2}  ", myCardVules, myCard1.getCardName(), myCard2.getCardName());
            }

            return(actionMssg);
        }
Exemplo n.º 3
0
        public string doAction(CardContext context)
        {
            context.setCardState(this);
            //Console.WriteLine("This the Hard hands");
            //Console.WriteLine("My first Card is:{0} and my Second card is:{1}", this.myCard1.getCardName(), this.myCard2.getCardName());
            //Console.WriteLine("Dealer Card is:{0}", this.dealerCard.getCardName());
            int myCardVules     = myCard1.CardValue + myCard2.CardValue;
            int dealerCardValue = dealerCard.CardValue;


            if (myCardVules >= 17)
            {
                handActhion = new Stick();
                //Console.WriteLine("Your Hand value is: {0}, Always Stick on a two card 17+", myCardVules);
                actionMssg = string.Format("Your Hand value is: {0}, Always Stick on a two card 17+", myCardVules);
            }
            else if ((myCardVules == 5) && myCardVules <= 8)
            {
                handActhion = new Hit();
                //Console.WriteLine("Your Hand value is: {0},Always Hit on cards a total card value of 5 - 8", myCardVules);

                actionMssg = string.Format("Your Hand value is: {0},Always Hit on cards a total card value of 5 - 8", myCardVules);
            }
            else if ((myCardVules == 13 && myCardVules <= 16) && dealerCardValue == 2 && dealerCardValue <= 6)
            {
                handActhion = new Stick();
                //Console.WriteLine("Your Hand value is: {0}, Always Stick when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Stick when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }
            else if ((myCardVules == 13 && myCardVules <= 16) && dealerCardValue >= 7)
            {
                handActhion = new Hit();
                // Console.WriteLine("Your Hand value is: {0}, Always Hit when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Stick when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }
            else if (((myCardVules == 12) && dealerCardValue == 2 && dealerCardValue <= 3) || ((myCardVules == 12) && dealerCardValue >= 7))
            {
                handActhion = new Hit();
                //Console.WriteLine("Your Hand value is: {0}, Always Hit when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Hit when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }
            else if ((myCardVules == 12) && dealerCardValue == 4 && dealerCardValue <= 6)
            {
                handActhion = new Stick();
                //Console.WriteLine("Your Hand value is: {0}, Always Stick when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Stick when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }
            else if ((myCardVules == 9) && dealerCardValue == 2 || dealerCardValue >= 7)
            {
                handActhion = new Hit();
                //Console.WriteLine("Your Hand value is: {0}, Always Hit when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Hit when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }//---------Double Down Starts
            else if (((myCardVules == 9) && dealerCardValue == 3 && dealerCardValue <= 6) || ((myCardVules == 10) && dealerCardValue >= 9) || ((myCardVules == 11) && dealerCardValue >= 10))
            {
                handActhion = new DoubleDown();
                //Console.WriteLine("Your Hand value is: {0}, Always Double Down when vs dealers faceup card {1},", myCardVules, dealerCardValue);
                actionMssg = string.Format("Your Hand value is: {0}, Always Double Down when vs dealers faceup card {1},", myCardVules, dealerCardValue);
            }

            return(actionMssg);
        }