//vrací procenta na dokonční dané kombinace na flopu public static double PercToCompFlop(PokerCard[] myCard, PokerCard[] tableCard,CartCombination combination) { int spravne = CartToCombinationFlop(myCard, tableCard, combination).Count; int vsechny = AllCombinationFlop(myCard, tableCard).Count; return (double)spravne/(double)vsechny; }
//správné kombinace pro Turn public static List<PokerCard> CartToCombinationTurn(PokerCard[] myCard, PokerCard[] tableCard, CartCombination combination) { List<PokerCard> balicek = FillTheStack(ArraysToList(myCard, tableCard)); List<PokerCard> Moznekarty = new List<PokerCard>(); for (int i = 0; i < balicek.Count; i++) { PokerCard[] mozne = {balicek[i]}; if (PokerCartCombination.CombinationExist(ArraysToList(myCard, tableCard, mozne), combination)) { Moznekarty.Add(balicek[i]); } } return Moznekarty; }
//vrací procenta na dokonční dané kombinace na turnu public static double PercentToCompTurn(PokerCard[] myCard, PokerCard[] tableCard, CartCombination combination) { int cards = CartToCombinationTurn(myCard, tableCard, combination).Count; int all = AllCombinationTurn(myCard,tableCard).Count; return cards/(double) all; }
//vrací zda karta v listu existuje public static bool CartInStackExist(List<PokerCard> cart, PokerCard mycard) { foreach (var c in cart) { if (mycard.Color == c.Color && mycard.Value == c.Value) return true; } return false; }
//vrací konkretní karty které jsou možné na dokonční dané kombinace na flopu public static List<PokerCard[]> CartToCombinationFlop(PokerCard[] myCard, PokerCard[] tableCard, CartCombination combination) { List<PokerCard> balicek = FillTheStack(ArraysToList(myCard,tableCard)); List<PokerCard[]> Moznekarty = new List<PokerCard[]>(); for (int c1 = 0; c1 < balicek.Count; c1++) { for (int c2 = c1 + 1; c2 < balicek.Count; c2++) { if (!c1.Equals(c2)) { PokerCard[] mozne = { balicek[c1], balicek[c2] }; if (PokerCartCombination.CombinationExist(ArraysToList(myCard, tableCard, mozne), combination)) { Moznekarty.Add(mozne); } } } } return Moznekarty; }
//vrací všechny kombinace pro flop public static List<PokerCard[]> AllCombinationFlop(PokerCard[] myCard, PokerCard[] tableCard) { List<PokerCard> balicek = FillTheStack(ArraysToList(tableCard, myCard)); List<PokerCard[]> kombinace = new List<PokerCard[]>(); for (int c1 = 0; c1 < balicek.Count; c1++) { for (int c2 = c1 + 1; c2 < balicek.Count; c2++) { if (!c1.Equals(c2)) { PokerCard[] mozne = { balicek[c1], balicek[c2]}; kombinace.Add(mozne); } } } return kombinace; }
//Všechny kombinace pro TURN public static List<PokerCard> AllCombinationTurn(PokerCard[] myCard, PokerCard[] tableCard) { List<PokerCard> balicek = FillTheStack(ArraysToList(tableCard, myCard)); List<PokerCard> kombinace = new List<PokerCard>(); for (int i = 0; i < balicek.Count; i++) kombinace.Add(balicek[i]); return kombinace; }
//adding public void SetMyCards(PokerCard card) { if (myCards.Count < 2)this.myCards.Add(card); }
public void SetTableCard(PokerCard card) { if (!ValidCards(card)) throw new System.ArgumentException("Card is alredy Exist or have invalid value, color!!!", "Shit :("); if (tableCards.Count < 5) tableCards.Add(card); }
//deleting public void DeleteTableCart(PokerCard card) { for (int i = 0; i < tableCards.Count; i++) { if (tableCards[i].Value == card.Value && tableCards[i].Color == card.Color) tableCards.RemoveAt(i); } }
public void DeleteMyCart(PokerCard card) { for (int i = 0; i < myCards.Count; i++) { if (myCards[i].Value == card.Value && myCards[i].Color == card.Color) myCards.RemoveAt(i); } }
public bool CartExistInTable(PokerCard card) { for (int i = 0; i < tableCards.Count; i++) { if (tableCards[i].Color == card.Color && tableCards[i].Value == card.Value) return true; } return false; }
public bool CartExistInMyCards(PokerCard card) { for (int i = 0; i < myCards.Count; i++) { if (myCards[i].Color == card.Color && myCards[i].Value == card.Value) return true; } return false; }
public bool CartExist(PokerCard card) { List<PokerCard> pom = new List<PokerCard>(); for(int i = 0;i< myCards.Count;i++) pom.Add(myCards[i]); for(int i = 0;i< tableCards.Count;i++) pom.Add(tableCards[i]); return PokerMath.CartInStackExist(pom,card); }