public override void PlaceBets()
        {
            RemoveBets();

            if (Statistics.LastNumber.HasValue)
                _LastBet = PlaceBetOnNumber(Statistics.LastNumber.Value);
        }
Example #2
0
        protected NumberBetViewModel PlaceBetOnNumber(int number, double amount = 0)
        {
            if (!Settings.IsBettingEnabled)
                return null;

            if (amount == 0)
                amount = Settings.DefaultBet.Amount.Value;

            if (amount < Settings.MinBetAmount)
                amount = Settings.MinBetAmount;
            else if (amount > Settings.MaxBetAmount)
                amount = Settings.MaxBetAmount;

            if (!Settings.IsSimulationMode)
            {
                RouletteBoardHelper.SetBet(Settings.DefaultBet);

                int betClicksToAmount = 1;
                if (amount > 0)
                    betClicksToAmount = (int)(amount / Settings.DefaultBet.Amount.Value);

                for (int i = 0; i < betClicksToAmount; i++)
                {
                    RouletteBoardHelper.ClickButton(number);
                }
            }

            //int curStreakCount = GetOppositeStreakCount(betKind);
            double betAmount = amount == 0 ? Settings.DefaultBet.Amount.Value : amount;

            var newBet = new NumberBetViewModel(number, betAmount, ApplicationViewModel.Instance.Session.ElapsedTime);
            Statistics.AddBetToHistory(newBet);

            return newBet;
        }
Example #3
0
        protected BetResultKind CalculateWinningsOnBet(NumberBetViewModel bet, CasinoNumberViewModel curNumber)
        {
            if (bet == null)
                return BetResultKind.None;

            if (curNumber == null)
            {
                bet.Result = BetResultKind.Unclear;
            }
            else
            {
                bool isWin = curNumber.Number == bet.Number;
                if (isWin)
                {
                    Statistics.WinningsAmount += bet.Amount * 35;
                    Statistics.WinCount++;

                    bet.Result = BetResultKind.Win;
                }
                else
                {
                    Statistics.LossesAmount += bet.Amount;
                    Statistics.LossCount++;

                    bet.Result = BetResultKind.Loss;
                }
            }

            return bet.Result;
        }
 public void AddBetToHistory(NumberBetViewModel bet)
 {
     if (!_NumberBetHistory.Contains(bet))
         _NumberBetHistory.Add(bet);
 }