/// <summary> /// Check if the combination is reached. /// </summary> /// <returns><c>true</c> if combination is reached, <c>false</c> otherwise.</returns> protected override bool ComputeReached() { bool result = false; if (SeenCards != null && SeenCards.Count >= 4) { List <Card> seenCardsClone = new List <Card>(SeenCards); PairCombination pair1 = new PairCombination(); pair1.Compute(seenCardsClone, true); if (pair1.Reached) { // First pair found, look for a pair in remaining cards // Remove first pair cards foreach (Card card in pair1.CombinationCards) { CombinationCards.Add(card); seenCardsClone.Remove(card); } PairCombination pair2 = new PairCombination(); pair2.Compute(seenCardsClone, true); if (pair2.Reached) { // Two pairs reached CombinationCards.AddRange(pair2.CombinationCards); result = true; } } } return(result); }
/// <summary> /// Check if the combination is reached. /// </summary> /// <returns><c>true</c> if combination is reached, <c>false</c> otherwise.</returns> protected override bool ComputeReached() { bool result = false; if (SeenCards != null && SeenCards.Count >= 5) { List <Card> seenCardsClone = new List <Card>(SeenCards); TripletsCombination triplet = new TripletsCombination(); triplet.Compute(seenCardsClone, true); if (triplet.Reached) { // Triplet found, look for a pair in remaining cards // Remove triplet cards foreach (Card card in triplet.CombinationCards) { CombinationCards.Add(card); seenCardsClone.Remove(card); } PairCombination pair = new PairCombination(); pair.Compute(seenCardsClone, true); if (pair.Reached) { // Full reached CombinationCards.AddRange(pair.CombinationCards); result = true; } } } return(result); }
/// <summary> /// Compute outs to reach the combination. /// </summary> /// <returns>Outs to reach the combination.</returns> protected override int ComputeOuts() { int result = 0; DoublePairsCombination doublePairs = new DoublePairsCombination(); doublePairs.Compute(SeenCards, true); if (doublePairs.Reached) { // Two pairs result = 4; List <Card> seenCardsClone = new List <Card>(SeenCards); foreach (Card card in doublePairs.CombinationCards) { seenCardsClone.Remove(card); } PairCombination pair = new PairCombination(); pair.Compute(seenCardsClone); if (pair.Reached) { // Three pairs result += 2; } } else { PairCombination pair = new PairCombination(); pair.Compute(SeenCards, true); if (pair.Reached) { // Already a pair, missing one card result = 2; } } return(result); }
/// <summary> /// Compute outs to reach the combination. /// </summary> /// <returns>Outs to reach the combination.</returns> protected override int ComputeOuts() { int result = 0; PairCombination pair = new PairCombination(); pair.Compute(SeenCards, true); if (pair.Reached) { // A single pair is already reached, compute outs to reach a second pair result = 3 * (SeenCards.Count - 2); } return(result); }
/// <summary> /// Check if the combination is reached. /// </summary> /// <returns><c>true</c> if combination is reached, <c>false</c> otherwise.</returns> protected override bool ComputeReached() { bool result = false; if (SeenCards != null && SeenCards.Count >= 4) { List <Card> seenCardsClone = new List <Card>(SeenCards); DoublePairsCombination doublePairs = new DoublePairsCombination(); doublePairs.Compute(seenCardsClone, true); if (doublePairs.Reached) { // Double pair found, check if it is a quads if (doublePairs.CombinationCards[0].Weight == doublePairs.CombinationCards[2].Weight) { // Quads reached CombinationCards.AddRange(doublePairs.CombinationCards); result = true; } else { // Look for a possible third pair foreach (Card card in doublePairs.CombinationCards) { seenCardsClone.Remove(card); } PairCombination pair = new PairCombination(); pair.Compute(seenCardsClone, true); if (pair.Reached) { if (pair.CombinationCards[0].Weight == doublePairs.CombinationCards[0].Weight) { // Quads reached CombinationCards.Add(doublePairs.CombinationCards[0]); CombinationCards.Add(doublePairs.CombinationCards[1]); CombinationCards.AddRange(pair.CombinationCards); result = true; } else if (pair.CombinationCards[0].Weight == doublePairs.CombinationCards[2].Weight) { // Quads reached CombinationCards.Add(doublePairs.CombinationCards[2]); CombinationCards.Add(doublePairs.CombinationCards[3]); CombinationCards.AddRange(pair.CombinationCards); result = true; } } } } } return(result); }