/// <summary> /// Retrieve the winning amount for an outcome containing the /// specified number of the specified symbol. /// </summary> public int GetWinnings(Enums.WheelSymbol symbol, int count) { WheelSymbolCount entry = new WheelSymbolCount(symbol, count); if (!_winningsSettings.ContainsKey(entry)) { return(0); } return(_winningsSettings[entry]); }
/// <summary> /// Update the winnings entry corresponding to the specified wheel symbols. /// </summary> private void UpdateItem(WheelSymbolCount wsCount, int newWinnings) { ItemViewModelWinningsEntry entry = new ItemViewModelWinningsEntry(wsCount, newWinnings); for (int index = 0; index < _winList.Count; index++) { if (_winList[index].Equals(entry)) { // We found the matching entry, so update it by deleting // and re-inserting with the updated winnings amount. _winList.RemoveAt(index); _winList.Insert(index, entry); return; } } }
/// <summary> /// Set the winning amount for an outcome containing the /// specified number of the specified symbol. /// </summary> public void SetWinnings(Enums.WheelSymbol symbol, int count, int winAmount) { if (count < 1 || winAmount < 0) { throw new ArgumentException(nameof(SetWinnings)); } WheelSymbolCount entry = new WheelSymbolCount(symbol, count); if (!_winningsSettings.ContainsKey(entry)) { _winningsSettings.Add(entry, winAmount); } else { _winningsSettings[entry] = winAmount; } OnPropertyChanged(nameof(WinningsSettings)); }
/// <summary> /// Calculate the probability for an outcome containing /// the specified number of the specified symbol. /// </summary> public double ProbabilityForSymbolCount(WheelSymbolCount wsCount) { double probability = 1.0; int probabilityPercent = _logicProbabilitySetup.GetProbability(wsCount.Symbol); // Probability for symbol to appear "count" times for (int i = 0; i < wsCount.Count; i++) { probability = probability * (probabilityPercent * 1.0) / 100.0; } // Probability for symbol NOT to appear in rest of symbols for (int i = 0; i < Configuration.Constants.NoOfWheels - wsCount.Count; i++) { probability = probability * ((100 - probabilityPercent) * 1.0) / 100.0; } // Multiply by number of ways this outcome can appear probability = probability * Combinations(Configuration.Constants.NoOfWheels, wsCount.Count); return(probability); }
public ItemViewModelWinningsEntry(WheelSymbolCount wsCount, int winAmount) { _wsCount = wsCount; _winAmount = winAmount; }