public void TakeBestCards(List <Card> tablecards) { List <Card> allcards = new List <Card>(7); allcards.AddRange(tablecards); allcards.AddRange(hand); if (tablecards.Count > 3) { Combination buffer; if (allcards.Count == 6) { buffer = new Combination(); for (int i = 0; i < 5; i++) { buffer.InsertCard(allcards[i]); } buffer = buffer.ImproveIfPossible(allcards[5]); cards.CleanCombination(); cards.InsertCard(buffer.GetCards()); buffer = null; } else { Combination strongest = new Combination(cards.GetCards()); int j = 1; for (int i = 0; i < allcards.Count - 1; i++) { while (i + j < allcards.Count) { buffer = new Combination(); for (int k = 0; k < allcards.Count; k++) { if ((k != i) && (k != j)) { buffer.InsertCard(allcards[k]); } } if (Combination.Compare(buffer, strongest) > 0) { strongest.CleanCombination(); strongest.InsertCard(buffer.GetCards()); } buffer = null; j++; } } List <Card> leftcards = new List <Card>(); foreach (Card c in allcards) { if (!strongest.GetCards().Contains(c)) { leftcards.Add(c); } } strongest = strongest.ImproveIfPossible(leftcards[0]); strongest = strongest.ImproveIfPossible(leftcards[1]); cards.InsertCard(strongest.GetCards()); } } else { List <Card> buffer = new List <Card>(5); buffer = cards.GetCards(); for (int i = 0; i < allcards.Count; i++) { if (!buffer.Contains(allcards[i])) { cards.InsertCard(allcards[i]); } } } }
private double AnalizeCombination() { double result = 0; Combination test = new Combination(game.table.cards); test.CountCombination(); test.Rebuild(); bool wettable = Combination.Compare(cards, test) <= 0; switch (cards.combination) { case Combinations.StreightFlash: { if (!wettable) { result = 1.5; } else { result = 1; } break; } case Combinations.Kare: { if (!wettable) { result = 1.5; } else { result = 1; } break; } case Combinations.FullHouse: { if (!wettable) { result = 1.4; } else { result = 0.9; } break; } case Combinations.Flash: { if (!wettable) { result = 1.3; } else { result = 0.8; } break; } case Combinations.Streight: { if (!wettable) { result = 1.2; } else { result = 0.7; } break; } case Combinations.Tree: { if (!wettable) { result = 1.1; } else { result = 0.6; } break; } case Combinations.TwoPairs: { if (!wettable) { result = 1; } else { result = 0.5; } break; } case Combinations.Pair: { if (!wettable) { result = 0.8; } else { result = 0.3; } break; } case Combinations.HighCard: { if (!wettable) { result = 0.6; } else { result = 0.1; } break; } } return(result); }