public HandMask[][][] Calculate(HandRange[] ranges, Card[] boardCards, int numIterations, bool[] show) { Count = 0; ulong board = 0ul; ulong[] boardParts = new ulong[3]; int[] numCardsSelected = new int[3]; HandMask[][][] conditionMasks = new HandMask[numIterations][][]; //------------------------------------------------------------------------------------- // Get all the possible hand ranges and their probabilities given the range data //------------------------------------------------------------------------------------- HandProbability[][] combos = CollateHandRangeCombinations(ranges); //------------------------------------------------------------------------------------- // Initialise the board mask from the model data //------------------------------------------------------------------------------------- int numCards = InitialiseBoardCards(boardCards, ref boardParts, ref numCardsSelected, ref board); //------------------------------------------------------------------------------------- // Iterate through a series of random sets of board cards //------------------------------------------------------------------------------------- for (int i = 0; i < numIterations; i++) { conditionMasks[i] = GetConditionResults(new ulong[0], ranges, combos, show, board, boardParts, numCardsSelected); Count++; } return conditionMasks; }
public Deck() { Cards = new Card[52]; for (int i = 0; i < 52; i++) { Cards[i] = new Card(i); } }
protected int InitialiseBoardCards(Card[] boardCards, ref ulong[] boardParts, ref int[] numCardsSelected, ref ulong board) { int numCards = 0; for (int i = 0; i < 5; i++) { if (boardCards[i] != null) { if (i <= 2) { boardParts[0] |= boardCards[i].RawLong; numCardsSelected[0]++; } else if (i <= 3) { boardParts[1] |= boardCards[i].RawLong; numCardsSelected[1]++; } else { boardParts[2] |= boardCards[i].RawLong; numCardsSelected[2]++; } board |= boardCards[i].RawLong; numCards++; } } return numCards; }
public static Card[] GetBoard(string key, NameValueCollection form) { string range = form[key]; JavaScriptSerializer serialiser = new JavaScriptSerializer(); int[] json = (int[])serialiser.Deserialize(range, typeof(int[])); Card[] ret = new Card[5]; for (int i = 0; i < 5 && json != null; i++) if (json.Length > i) ret[i] = new Card(json[i]); return ret; }
public CardModel(int card) { ModelCard = new Card(card); }