예제 #1
0
        public string DisplayBoardInfo()
        {
            string Result = "";

            Result += RDeepPlayer.ShowPlayerCoins(boardPlayers);
            Result += boardDealer.ShowDealerCoins();
            return(Result);
        }
예제 #2
0
        public IEnumerable <RDeepBet> GoForBet(RDeepPlayer player, List <RDeepPosition> LastNumbers)
        {
            if (player.coins.Count < 1)
            {
                throw new Exception("Running out of coins!");
            }

            List <RDeepBet> result = new List <RDeepBet>();

            RDeepPosition maxProbableNumber = RDeepPosition.Six;
            float         maxProbability    = maxProbableNumber.defaultProbability;

            if (probabilities.Count < 1)
            {
                UpdateProbabilities(LastNumbers);
            }

            foreach (RDeepPosition number in wheelNumbers)
            {
                if (maxProbability < probabilities[number])
                {
                    maxProbability    = probabilities[number];
                    maxProbableNumber = number;
                }
            }

            List <Coin> betCoins = new List <Coin>();

            int randomTotalCoins;

            if (player.coins.Count(coin => coin.isOnBet == false && coin.Value <= 25) < 4)
            {
                randomTotalCoins = 1;
            }
            else
            {
                randomTotalCoins = Generic.GetRandomNumber(1, 2);
            }

            for (int i = 0; i < randomTotalCoins; i++)
            {
                List <Coin> activeCoins = player.coins.Where(coin => coin.isOnBet == false && coin.Value <= 25).ToList();
                int         randomCoin  = Generic.GetRandomNumber(0, activeCoins.Count);
                activeCoins[randomCoin].isOnBet = true;
                betCoins.Add(activeCoins[randomCoin]);
                System.Threading.Thread.Sleep(100);
            }

            result.Add(new RDeepBet(
                           player,
                           RDeepBetPositions.GetRDeepBetPositionByPositionIDs(new int[] { maxProbableNumber.ID }),
                           betCoins));

            return(result);
        }
예제 #3
0
        public IEnumerable <RDeepBet> GoForBetRandomBetTypes(RDeepPlayer player, List <RDeepPosition> LastNumbers)
        {
            List <RDeepBet> result = new List <RDeepBet>();

            if (player.coins.Count < 1)
            {
                throw new Exception("Running out of coins!");
            }

            int randomNoOfBets = Generic.GetRandomNumber(1, 4);

            for (int b = 0; b < randomNoOfBets; b++)
            {
                int         BetPosition = Generic.GetRandomNumber(1, RDeepBetPositions.Total + 1);
                List <Coin> betCoins    = new List <Coin>();

                int randomTotalCoins;

                if (player.coins.Count < 4)
                {
                    randomTotalCoins = 1;
                }
                else
                {
                    randomTotalCoins = Generic.GetRandomNumber(1, 2);
                }

                for (int i = 0; i < randomTotalCoins; i++)
                {
                    List <Coin> activeCoins = player.coins.Where(coin => coin.isOnBet == false && coin.Value <= 5).ToList();
                    int         randomCoin  = Generic.GetRandomNumber(0, activeCoins.Count);
                    activeCoins[randomCoin].isOnBet = true;
                    betCoins.Add(activeCoins[randomCoin]);
                    System.Threading.Thread.Sleep(100);
                }

                result.Add(new RDeepBet(
                               player,
                               RDeepBetPositions.GetRDeepBetPositionByID(BetPosition),
                               betCoins));

                if (player.coins.Count == 0)
                {
                    break;
                }

                System.Threading.Thread.Sleep(150);
            }

            return(result);
        }
예제 #4
0
 public RDeepBet(RDeepPlayer player, RDeepBetPosition betPosition, List <Coin> betCoins)
 {
     try
     {
         Player      = player;
         BetPosition = betPosition;
         BetCoins    = betCoins;
         Coins.SetBetStatus(betCoins, true);
         status = BetStatus.Placed;
     }
     catch (Exception e)
     {
         Coins.SetBetStatus(betCoins, false);
         throw e;
     }
 }
예제 #5
0
        public IEnumerable <RDeepBet> GoForBet(RDeepPlayer player, List <RDeepPosition> LastNumbers)
        {
            List <RDeepBet> result = new List <RDeepBet>();

            int randomWheelNumber = 7;

            randomWheelNumber = Generic.GetRandomNumber(0, 38);

            if (player.coins.Count(coin => coin.isOnBet == false && coin.Value <= 25) < 1)
            {
                throw new Exception("Running out of coins!");
            }

            List <Coin> betCoins = new List <Coin>();

            int randomTotalCoins;

            if (player.coins.Count < 4)
            {
                randomTotalCoins = 1;
            }
            else
            {
                randomTotalCoins = Generic.GetRandomNumber(1, 2);
            }

            for (int i = 0; i < randomTotalCoins; i++)
            {
                List <Coin> activeCoins = player.coins.Where(coin => coin.isOnBet == false && coin.Value <= 25).ToList();
                int         randomCoin  = Generic.GetRandomNumber(0, activeCoins.Count);
                activeCoins[randomCoin].isOnBet = true;
                betCoins.Add(activeCoins[randomCoin]);
                System.Threading.Thread.Sleep(100);
            }

            result.Add(new RDeepBet(
                           player,
                           RDeepBetPositions.GetRDeepBetPositionByPositionIDs(new int[] { randomWheelNumber }),
                           betCoins));

            return(result);
        }
예제 #6
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);
                    }
                }
            }
        }
예제 #7
0
        private void CallForPlayers()
        {
            RDeepPlayer RDeepPlayer = new RDeepPlayer("Mr.A", 100000, "Random");

            boardPlayers.Add(RDeepPlayer);

            RDeepPlayer RDeepPlayer2 = new RDeepPlayer("Mr.B", 100000, "TenFifteen");

            boardPlayers.Add(RDeepPlayer2);

            /*
             * RDeepPlayer RDeepPlayer3 = new RDeepPlayer("Mr.C", 5000);
             * boardPlayers.Add(RDeepPlayer3);
             *
             * RDeepPlayer RDeepPlayer4 = new RDeepPlayer("Mr.D", 5000);
             * boardPlayers.Add(RDeepPlayer4);*/

            boardDealer = new RDeepDealer("Mr. Dealer", 500000);

            //Participant.TransferCoins(RDeepPlayer, dealer, RDeepPlayer.TakeCoins(CoinType.One, 2).ToList());
        }
예제 #8
0
 private void JoinPlayer(RDeepPlayer player)
 {
     boardPlayers.Add(player);
 }