예제 #1
0
        public static HandsetModel SetsOfThree(HandModel hand)
        {
            HandsetModel setsOf3 = new HandsetModel();

            for (int x = 0; x < 5; x++)
            {
                for (int y = x + 1; y < 5; y++)
                {
                    for (int z = y + 1; z < 5; z++)
                    {

                        setsOf3.Hands.Add(new HandModel(new CardModel[] { hand.Cards[x], hand.Cards[y], hand.Cards[z] }));
                    }
                }
            }

            return setsOf3;
        }
예제 #2
0
        public static HandsetModel SetsOfTwo(HandModel hand)
        {
            HandsetModel setsOf2 = new HandsetModel();

            for (int x = 0; x < 5; x++)
            {
                for (int y = x + 1; y < 5; y++)
                {

                    setsOf2.Hands.Add(new HandModel(new CardModel[] { hand.Cards[x], hand.Cards[y] }));


                }

            }

            return setsOf2;
        }
예제 #3
0
        public static HandsetModel SetsOfFour(HandModel hand)
        {
            HandsetModel setsOf4 = new HandsetModel();

            for (int x = 0; x < 2; x++)
            {
                for (int y = x + 1; y < 3; y++)
                {
                    for (int z = y + 1; z < 4; z++)
                    {
                        for (int w = z + 1; w < 5; w++)
                        {

                            setsOf4.Hands.Add(new HandModel(new CardModel[] { hand.Cards[x], hand.Cards[y], hand.Cards[z], hand.Cards[w] }));
                        }
                    }
                }
            }

            return setsOf4;
        }
예제 #4
0
 public static ScoringHandModel Nobs(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.Nobs);
 }
예제 #5
0
 public static ScoringHandModel RunOfFive(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.RunOfFive);
 }
예제 #6
0
 public static ScoringHandModel Flush(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.Flush);
 }
예제 #7
0
 public static ScoringHandModel ThreeOfAKind(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.ThreeOfAKind);
 }
예제 #8
0
 public static ScoringHandModel FourOfAKind(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.FourOfAKind);
 }
예제 #9
0
 public static ScoringHandModel Pair(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.Pair);
 }
예제 #10
0
 public static ScoringHandModel Fifteen(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.Fifteen);
 }
예제 #11
0
 public static ScoringHandModel NineteenHand(HandModel hand)
 {
     return new ScoringHandModel(hand, ScoringType.Nineteen);
 }
예제 #12
0
 public ScoringHandModel(HandModel cards, ScoringType scoreType)
 {
     this.cards = cards.Cards;
     this.ScoreType = scoreType;
 }
예제 #13
0
        public  ObservableCollection<ScoringHandModel> CountHands(HandModel hand)
        {


            ScoringCombos.Clear();
            

            

            //Get Sets of 2,3,4 and 5 is just hand            

            HandsetModel allHands = new HandsetModel();

            allHands.Hands.Add(hand);
            allHands.Hands.AddRange(HandsetModel.SetsOfFour(hand).Hands);
            allHands.Hands.AddRange(HandsetModel.SetsOfThree(hand).Hands);
            allHands.Hands.AddRange(HandsetModel.SetsOfTwo(hand).Hands);
            
            //Check 15s First

            

            

            CheckFor15s(allHands);


            CheckForMatches(allHands);
            
            
            
                //Check for Runs



            CheckForRuns(allHands);
                

                      
                
                        
                    
                //Check For Flush
                if (hand.Cards.All(x => x.Suit == hand.Cards[0].Suit))
                {
                    ScoringCombos.Add(ScoringHandModel.Flush(hand));
                }
            

            

            
          //  player.Score += score;
                return ScoringCombos;
            
        }