/// <summary> /// Compute outs to reach the combination. /// </summary> /// <returns>Outs to reach the combination.</returns> protected override int ComputeOuts() { int result = 0; if (SeenCards.Count >= 4) { for (int family = 0; family <= CardSet.CardFamiliesCount; family++) { for (byte i = 0; i < CardSet.CardsPerFamilyCount; i++) { Card testCard = new Card(i, (CardFamilies)family); if (!SeenCards.Contains(testCard)) { // Try to add missing card one by one List <Card> testCards = new List <Card>(SeenCards); testCards.Add(testCard); StraightFlushCombination straightFlush = new StraightFlushCombination(); straightFlush.Compute(testCards, true); if (straightFlush.Reached) { // Adding this test card allow to reach the combination, add this as an out result++; } } } } } return(result); }
public void UpdateSeenCards(bool i_IsAMatch, params Cell[] i_PairOfCards) { if (i_IsAMatch == true) { // In case there's a match we need to remove the elements tha't have been seen SeenCards.Remove(i_PairOfCards[0].CellContent); } else { AddIfNotInSeenCards(i_PairOfCards[0]); AddIfNotInSeenCards(i_PairOfCards[1]); } }
public void AddIfNotInSeenCards(Cell i_CardToAdd) { if (SeenCards.TryGetValue(i_CardToAdd.CellContent, out List <Location> keyList)) { if (keyList.Contains(i_CardToAdd.Location) == false) { keyList.Add(i_CardToAdd.Location); } } else { SeenCards.Add(i_CardToAdd.CellContent, new List <Location>()); SeenCards[i_CardToAdd.CellContent].Add(i_CardToAdd.Location); } }