public pokerDiceHand Reroll(pokerDiceHand oldHand, string facesToReRoll) { string oldFaces = oldHand.getFacesOrderedByRank(); bool remainderFoundOkay = false; string retainedFaces = Remainder(oldFaces, facesToReRoll, ref remainderFoundOkay); if (!remainderFoundOkay) { return(new pokerDiceHand("xxxxx")); } string newFaces = retainedFaces; string newRoll; for (int i = 0; i < facesToReRoll.Length; i++) { newRoll = mDieRoller.Roll(showAsString.y); newFaces += newRoll; } pokerDiceHand pdh = new pokerDiceHand(newFaces); return(pdh); }
public permutationsCalculator() { const int diceCount = 5; diceFaceTicker[] tickerArray = new diceFaceTicker[diceCount]; for (int i = 0; i < diceCount; i++) { tickerArray[i] = new diceFaceTicker(); } for (int j = diceCount - 1; j >= 1; j--) { tickerArray[j - 1].AddNeighbour(tickerArray[j]); } do { pokerDiceHand pdh = new pokerDiceHand(tickerArray[0].GetString()); string diceFacesOrderedByRank = pdh.getFacesOrderedByRank(); if (duplicatesCountTable.ContainsKey(diceFacesOrderedByRank)) { int oldCount = duplicatesCountTable[diceFacesOrderedByRank]; duplicatesCountTable[diceFacesOrderedByRank] = oldCount + 1; } else { duplicatesCountTable.Add(diceFacesOrderedByRank, 1); } tickerArray[0].Tick(); }while (tickerArray[diceCount - 1].hasOverflowed() == false); int debugNumberEntriesInDuplicatesCountTable = duplicatesCountTable.Count; this.permutationTable = "|"; foreach (var pair in duplicatesCountTable) { this.permutationTable += pair.ToString() + "|"; } }