예제 #1
0
        public void Spin(int value = -1)
        {
            if (bets.Count < 1)
            {
                throw new Exception("No bets");
            }

            if (value == -1)
            {
                value = Generic.GetRandomNumber(0, 38);
            }

            CurrentNumber = RDeepPositions.GetPositionByID(value);

            LastNumbers.Add(CurrentNumber);

            ValidateBetsForPlayers();

            SettleBets();

            foreach (RDeepPlayer player in boardPlayers)
            {
                player.UpgradeProbabilities(LastNumbers);
            }
        }
예제 #2
0
        public string DisplayBet()
        {
            string result = "\nBet:\t";

            result += "Player:\t" + Player.Name + ";\t";
            result += "Position:\t" + BetPosition.betType.ToString() + ";\t" + RDeepPositions.PositionsSummary(BetPosition.betPositions) + "\t";
            result += Coins.DisplayCoinsSummary(BetCoins);
            result += "Bet Value: " + Coins.CoinsValue(BetCoins);
            return(result);
        }
예제 #3
0
        private void UpdateProbabilitiesByPosType(PositionType positionType, List <RDeepPosition> LastNumbers, RDeepPosition currentPos)
        {
            int   HitCount    = 1;
            int   Factor      = 0;
            float UpgradeRate = 0;

            PositionTypeSubCategory subCategory = GetPositonSubCategoryByPositionType(positionType);
            PositionTypeCategory    category    = GetPositonTypeCategory(subCategory);

            PositionType hitPositionType = GetPositionType(subCategory, currentPos);

            List <RDeepPosition> fromNumbers = new List <RDeepPosition>();

            if (hitPositionType == PositionType.Straight)
            {
                fromNumbers.Add(currentPos);
            }
            else
            {
                fromNumbers = RDeepPositions.NumbersByPositionType(positionType).ToList();
            }

            List <RDeepPosition> toNumbers = wheelNumbers.Except(fromNumbers).ToList();

            if (positionType == hitPositionType)
            {
                // *** On Hit ***
                if (positionType != PositionType.Straight)
                {
                    HitCount = GetPositionTypeHitCount(subCategory, LastNumbers);
                }

                Factor = GetProbabilityUpgradeFactorsOnHit(category, HitCount);
            }
            // *** On Miss ***

            Factor += GetProbabilityUpgradeFactorsOnFewerHits(LastNumbers, category, positionType);

            float Rate = GetProbabilityUpgradeRate(fromNumbers.Count());

            UpgradeRate = Factor * Rate;

            ShiftProbability(fromNumbers, positionType, UpgradeRate);
            ShiftProbability(toNumbers, positionType, UpgradeRate * -1);
        }
예제 #4
0
        private static bool IsBetPositionMatchingWinningNumbers(int[] betPositions, int[] betWinningNumbers)
        {
            bool result = true;

            foreach (int pos in betPositions)
            {
                if (RDeepPositions.GetPositionByID(pos).isWheelNumber)
                {
                    //Winning numbers doesn't belong to bet positions even if one of the wheel number in bet position is NOT in the Winning Numbers
                    if (Utilities.Generic.IsNumberInArray(pos, betWinningNumbers) == false)
                    {
                        return(false);
                    }
                    //Outside Bet: If the bet positions doesn't have wheel numbers, it will never return false.
                }
            }
            return(result);
        }
예제 #5
0
        public string DisplayBetAndWinningNumbers()
        {
            string result = "***** Summary of roll *****\n";

            result += "\n\t** Current number is " + CurrentNumber.Name;

            foreach (RDeepPlayer player in boardPlayers)
            {
                result += "\nPlayer: " + player.Name;
                result += "\n\t -> Bet details: ";

                foreach (RDeepBet bet in bets.Where(bet => bet.Player.ID == player.ID))
                {
                    result += bet.DisplayBet();
                    int[] WinningNumbers = RDeepWiningNumbersList.GetBetWinNumbersByBetPosition(bet.BetPosition);
                    result += "\n\tPlayer bet winning numbers: " + RDeepPositions.PositionsSummary(WinningNumbers);
                    int Factor = 1;

                    if (bet.status == BetStatus.Won)
                    {
                        Factor = RDeepWiningNumbersList.BetPayOutFactorByBet(bet.BetPosition.betType);
                    }

                    result += "\n\tStatus: ";
                    if (bet.status == BetStatus.Lost)
                    {
                        result += " :( ";
                    }
                    if (bet.status == BetStatus.Won)
                    {
                        result += " :) ";
                    }
                    result += bet.status.ToString() + " $" + Factor * Coins.CoinsValue(bet.BetCoins);
                }
            }
            return(result);
        }
예제 #6
0
 private void LoadBoardBetPositions()
 {
     RDeepPositions         RDeepPositions = new RDeepPositions();
     RDeepBetPositions      betPos         = new RDeepBetPositions();
     RDeepWiningNumbersList betWinPos      = new RDeepWiningNumbersList();
 }
예제 #7
0
 public static string BetPositionsSummary(int[] Positions)
 {
     return(RDeepPositions.PositionsSummary(Positions));
 }