public bool IsValid(Bet bet) { switch (bet.Type) { case BetType.Straight: if (bet.Bets.Count != 1) { return(false); } if (!bet.Bets.TrueForAll(x => Slots.Contains(x))) { return(false); } return(true); case BetType.Split: if (bet.Bets.Count != 2) { return(false); } if (!bet.Bets.TrueForAll(x => Slots.Contains(x))) { return(false); } if (bet.Bets.Distinct().Count() != bet.Bets.Count) { return(false); } return(validSplit(bet.Bets[0], bet.Bets[1])); case BetType.Corner: if (bet.Bets.Count != 4) { return(false); } if (!bet.Bets.TrueForAll(x => Slots.Contains(x))) { return(false); } if (bet.Bets.Distinct().Count() != bet.Bets.Count) { return(false); } return(validCorner(bet.Bets)); case BetType.Street: if (bet.Bets.Count != 3) { return(false); } if (!bet.Bets.TrueForAll(x => Slots.Contains(x))) { return(false); } if (bet.Bets.Distinct().Count() != bet.Bets.Count) { return(false); } return(validStreet(bet.Bets)); case BetType.Trio: return(validTrio(bet.Bets)); case BetType.Basket: case BetType.Low: case BetType.High: case BetType.Red: case BetType.Black: case BetType.Even: case BetType.Odd: case BetType.Snake: return(true); //no input to validate case BetType.Column: return(validColumn(bet.Bets)); case BetType.Dozen: return(validDozen(bet.Bets)); default: return(false); } }
public (int, string) GetResult(Bet bet, int amount) { var rand = new Random(); string result = Slots[rand.Next(Slots.Count)]; switch (bet.Type) { case BetType.Straight: if (bet.Bets.Exists(x => x == result)) { return(35 * amount + amount, result); } break; case BetType.Split: if (bet.Bets.Exists(x => x == result)) { return(17 * amount + amount, result); } break; case BetType.Corner: if (bet.Bets.Exists(x => x == result)) { return(8 * amount + amount, result); } break; case BetType.Street: if (bet.Bets.Exists(x => x == result)) { return(11 * amount + amount, result); } break; case BetType.Trio: if (bet.Bets.Exists(x => x == result)) { return(11 * amount + amount, result); } break; case BetType.Basket: if (bet.Bets.Exists(x => x == result)) { return(6 * amount + amount, result); } break; case BetType.Low: if (bet.Bets.Exists(x => x == result)) { return(amount + amount, result); } break; case BetType.High: if (bet.Bets.Exists(x => x == result)) { return(amount + amount, result); } break; case BetType.Red: if (IsRed(result)) { return(amount + amount, result); } break; case BetType.Black: if (IsBlack(result)) { return(amount + amount, result); } break; case BetType.Even: if (IsEven(result)) { return(amount + amount, result); } break; case BetType.Odd: if (IsOdd(result)) { return(amount + amount, result); } break; case BetType.Snake: if (bet.Bets.Exists(x => x == result)) { return(2 * amount + amount, result); } break; case BetType.Column: if (bet.Bets.Exists(x => x == result)) { return(2 * amount + amount, result); } break; case BetType.Dozen: if (bet.Bets.Exists(x => x == result)) { return(2 * amount + amount, result); } break; } return(0, result); }