예제 #1
0
        public static bool ValidateBet(RDeepBetPosition RDeepBetPosition, int CurrentNumber)
        {
            bool result = false;

            int[] betWinPositions = RDeepWiningNumbersList.GetBetWinNumbersByBetPosition(RDeepBetPosition);

            //Is Current number in the Winning positions of the bet
            if (Utilities.Generic.IsNumberInArray(
                    CurrentNumber,
                    betWinPositions
                    ))
            {
                result = true;
            }

            return(result);
        }
예제 #2
0
        private void SettleBets()
        {
            foreach (RDeepPlayer player in boardPlayers)
            {
                foreach (RDeepBet bet in bets.Where(bet => bet.Player.ID == player.ID))
                {
                    Coins.SetBetStatus(bet.BetCoins, false);

                    int Factor = 1;

                    List <Coin> CoinsToDealer = new List <Coin>();
                    List <Coin> CoinsToPlayer = new List <Coin>();

                    if (bet.status == BetStatus.Won)
                    {
                        Factor = RDeepWiningNumbersList.BetPayOutFactorByBet(bet.BetPosition.betType);
                        foreach (IEnumerable <Coin> CoinsOfType in bet.BetCoins.GroupBy(coin => coin.CT))
                        {
                            CoinsToPlayer.AddRange(RDeepPlayer.TakeCoins(
                                                       boardDealer,
                                                       CoinsOfType.First().CT,
                                                       CoinsOfType.Count() * Factor));
                        }
                    }
                    else
                    {
                        CoinsToDealer.AddRange(bet.BetCoins);
                    }

                    if (CoinsToDealer.Count > 0)
                    {
                        RDeepPlayer.TransferCoins(bet.Player, boardDealer, CoinsToDealer);
                    }

                    if (CoinsToPlayer.Count > 0)
                    {
                        RDeepPlayer.TransferCoins(boardDealer, bet.Player, CoinsToPlayer);
                    }
                }
            }
        }
예제 #3
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);
        }
예제 #4
0
 private void LoadBoardBetPositions()
 {
     RDeepPositions         RDeepPositions = new RDeepPositions();
     RDeepBetPositions      betPos         = new RDeepBetPositions();
     RDeepWiningNumbersList betWinPos      = new RDeepWiningNumbersList();
 }
예제 #5
0
 public int GetFactor(int BetPosID)
 {
     return(RDeepWiningNumbersList.BetPayOutFactorByBet(GetRDeepBetPositionByID(BetPosID).betType));
 }