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; }
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; }
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; }
public static ScoringHandModel Nobs(HandModel hand) { return new ScoringHandModel(hand, ScoringType.Nobs); }
public static ScoringHandModel RunOfFive(HandModel hand) { return new ScoringHandModel(hand, ScoringType.RunOfFive); }
public static ScoringHandModel Flush(HandModel hand) { return new ScoringHandModel(hand, ScoringType.Flush); }
public static ScoringHandModel ThreeOfAKind(HandModel hand) { return new ScoringHandModel(hand, ScoringType.ThreeOfAKind); }
public static ScoringHandModel FourOfAKind(HandModel hand) { return new ScoringHandModel(hand, ScoringType.FourOfAKind); }
public static ScoringHandModel Pair(HandModel hand) { return new ScoringHandModel(hand, ScoringType.Pair); }
public static ScoringHandModel Fifteen(HandModel hand) { return new ScoringHandModel(hand, ScoringType.Fifteen); }
public static ScoringHandModel NineteenHand(HandModel hand) { return new ScoringHandModel(hand, ScoringType.Nineteen); }
public ScoringHandModel(HandModel cards, ScoringType scoreType) { this.cards = cards.Cards; this.ScoreType = scoreType; }
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; }