private void ProcessResult(SpinResult result) { foreach (var bet in Bets) { bet.WinAmount = 0; if (bet.Color.HasValue) { if (bet.Color == result.RouletteNumber.Color) { bet.WinAmount += bet.BetAmount * 2; } } if (bet.OutsideDozens.HasValue) { if (bet.OutsideDozens == result.RouletteNumber.IsInOutsizeDozen) { bet.WinAmount += bet.BetAmount * 3; } } foreach (var r in bet.RouletteNumbers) { if (r.Number == "0" || r.Number == "00") { bet.WinAmount += bet.BetAmount * 17; } else if (r.Number == result.RouletteNumber.Number) { if (bet.RouletteNumbers.Count == 4) { bet.WinAmount += bet.BetAmount * 8; } if (bet.RouletteNumbers.Count == 1) { bet.WinAmount += bet.BetAmount * 35; } if (bet.RouletteNumbers.Count == 2) { bet.WinAmount += bet.BetAmount * 16; } } } if (bet.WinAmount > 0) { Winners.Add(bet); } } }
public SpinResult Spin() { Winners.Clear(); var rouletteNumber = RandomizeResult(); var spinResult = new SpinResult(rouletteNumber); spinResult.RouletteNumber = rouletteNumber; LastSpinResult = spinResult; ProcessResult(spinResult); SpinHistory.Add(spinResult); return(spinResult); }