Ejemplo n.º 1
0
 public RoyalFlush(ICardHandPattern successor, ICardHandPattern straight, ICardHandPattern flush)
 {
     Successor = successor;
     StraightQualifier = straight;
     FlushQualifier = flush;
     rank = RankOfHand.RoyalFlush;
 }
Ejemplo n.º 2
0
 public FourOfAKind(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.FourOfAKind;
 }
Ejemplo n.º 3
0
 public Flush(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.Flush;
 }
Ejemplo n.º 4
0
 public OnePair(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.OnePair;
 }
Ejemplo n.º 5
0
 public FullHouse(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.FullHouse;
 }
Ejemplo n.º 6
0
 public Straight(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.Straight;
 }
Ejemplo n.º 7
0
        public void SetupCardPattern()
        {
            var highCard = new HighCard();
            var onePair = new OnePair(highCard);
            var twoPair = new TwoPair(onePair);
            var threeOfAKind = new ThreeOfAKind(twoPair);
            var straight = new Straight(threeOfAKind);
            var flush = new Flush(straight);
            var fullHouse = new FullHouse(flush);
            var fourOfAKind = new FourOfAKind(fullHouse);
            var straightFlush = new StraightFlush(fourOfAKind, straight, flush);
            var royalFlush = new RoyalFlush(straightFlush, straight, flush);

            cardHandIdentifier = royalFlush;

            pokerEngine = new PokerEngine();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Third requirement: Identify type of hand
        /// </summary>
        /// <param name="cardEvaluator"> the evaluator is injected from client </param>
        /// <param name="cardHand"> the hand need to be evaluated</param>
        /// <returns>the rank of hand</returns>
        public RankOfHand IdentifyRankOfHand(ICardHandPattern cardEvaluator, List<Card> cardHand)
        {
            try
            {
                return cardEvaluator.ProccessRequest(cardHand);
            }
            catch (PokerException pex)
            {
                // code to write log file: datetime, description

                throw new ApplicationException(pex.Message, pex);
            }
        }
Ejemplo n.º 9
0
 public ThreeOfAKind(ICardHandPattern successor)
 {
     Successor = successor;
     rank = RankOfHand.ThreeOfAKind;
 }