コード例 #1
0
        static void Main()
        {
            Bets bets = new Bets();
            int  bin  = Game.Roulette.Spin();

            Console.WriteLine($"\n\nThe winning number is {bin}");
            Console.WriteLine($"\nEvens and odds: {bets.EvensOdds(bin)}");
            Console.WriteLine($"\nReds/Blacks: {bets.RedsOrBlacks(bin)}");
            Console.WriteLine($"\nLows/Highs: {bets.LowsAndHighs(bin)}");
            Console.WriteLine($"\nDozens: {bets.Dozens(bin)}");
            Console.WriteLine($"\nColumns: {bets.Columns(bin)}");
            Console.WriteLine($"\nStreets: {bets.Street(bin)}");
            Console.WriteLine($"\n6 Numbers: {bets.SixNumbers(bin)}");
            Console.WriteLine($"\nSplit: {bets.Split(bin)}");
            Console.WriteLine($"\nCorner: {bets.Corner(bin)}");
            Console.WriteLine("\n\nWould you like to spin again? Y/n");
            string input = Console.ReadLine();

            if (input.ToLower() == "y")
            {
                Main();
            }
            else
            {
                return;
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jacobkeena/Roulette
        static void GamePlay()
        {
            Bets   bets = new Bets();
            Random rand = new Random();
            int    n    = rand.Next(0, 38);

            Console.Write("Rolling ball .");
            Task.Delay(1000).Wait();
            Console.Write(".");
            Task.Delay(1000).Wait();
            Console.Write(".");
            Task.Delay(1000).Wait();

            bool zeros = bets.CheckZeros(n);

            if (zeros == true)
            {
                Console.ReadLine();
                Console.ReadLine();
                return;
            }
            if (zeros == false)
            {
                Console.WriteLine($"Ball landed on : {n}");
                bets.IndividualNumberBet(n);
                bets.EvenOdd(n);
                bets.RedOrBlack(n, bets.RedNumbers, bets.BlackNumbers);
                bets.LowOrHigh(n);
                bets.Dozens(n);
                bets.Columns(n);
                bets.Street(n);
                bets.DoubleStreet(n);
                bets.Split(n);
                bets.Corner(n);
                Console.ReadLine();
            }
            Console.WriteLine("Play again? y/n [n]:");
            string answer = Console.ReadLine();

            if (answer == "y")
            {
                Console.Clear();
                GamePlay();
            }
            else
            {
                return;
            }
        }
コード例 #3
0
        static void Random()
        {
            Console.Clear();
            Bets   bet    = new Bets();
            Random random = new Random();

            int[] rednumber   = { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35 };
            int[] blacknumber = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36 };

            var a = random.Next(0, 38);

            if (a != 0 && a != 37)
            {
                if (a < 17)
                {
                    int rresult;
                    rresult = rednumber[new Random().Next(0, rednumber.Length)];
                    Console.WriteLine($"Red {rresult}\n");
                    Bets.Indnumb(rresult);
                    Bets.Odd();
                    Bets.Red();
                    Bets.HiLo(rresult);
                    bet.Column(rresult);
                    bet.Street(rresult);
                    bet.DStreet(rresult);
                    bet.Split(rresult);
                    bet.Corner(rresult);
                }
                if (a > 16)
                {
                    int bresult;

                    bresult = blacknumber[new Random().Next(0, blacknumber.Length)];
                    Console.WriteLine($"Black {bresult}\n");
                    Bets.Indnumb(bresult);
                    Bets.Even();
                    bet.Black();
                    Bets.HiLo(bresult);
                    bet.Column(bresult);
                    bet.Street(bresult);
                    bet.DStreet(bresult);
                    bet.Split(bresult);
                    bet.Corner(bresult);
                }
            }
            if (a == 0)
            {
                Console.WriteLine("0\n");
                Bets.Indnumb(a);
                Bets.Zero();
                Bets.HiLo(a);
                bet.Column(a);
                bet.Street(a);
                bet.DStreet(a);
                bet.Split(a);
                bet.Corner(a);
            }
            if (a == 37)
            {
                Console.WriteLine("00 \n");
                int b = 37;
                Bets.Indnumb(b);
                Bets.Zero();
                Bets.HiLo(b);
                bet.Column(b);
                bet.Street(b);
                bet.DStreet(b);
                bet.Split(b);
                bet.Corner(a);
            }
            Console.WriteLine("\n\nWould you like a new number? \n\n\n [1] Yes\n\n [2] to exit ");
            double result;

            double.TryParse(Console.ReadLine(), out result);
            switch (result)
            {
            case 1:
                Random();
                return;

            case 2:
                Exit();
                return;

            default:
                Random();
                return;
            }
        }
コード例 #4
0
        public static int PlayRoulette(int Wallet)
        {
            Console.Clear();
            Console.WriteLine("\nWhat would you like to play?\n \nNumbers,  Evens/Odds,  Reds/Blacks, " +
                              " Lows/Highs,  Dozens,  Columns,  Street,  6 Numbers,  Split,  or Corner.\n");
            string StrGameType = Console.ReadLine(); string result = "";
            string GameType = CheckRespone.GameType(StrGameType);

            Console.WriteLine($"How much would you like to bet? You have {Wallet}");
            string StrBet = Console.ReadLine(); int bet = Bets.StringtoInt(StrBet);

            while (bet < 0)
            {
                Console.WriteLine("That is not a valid number! Try again!");
                StrBet = Console.ReadLine(); bet = Bets.StringtoInt(StrBet);
            }
            while (Wallet < bet)
            {
                Console.WriteLine("You do not have that much money! Enter a amount you have!");
                StrBet = Console.ReadLine(); bet = Bets.StringtoInt(StrBet);
            }
            Wallet -= bet; Console.Clear();
            Console.WriteLine($"\nPlaying {GameType}");
            if (GameType == "Numbers")
            {
                result = Bets.Numbers(); //Pay 35 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 36);
                }
            }
            if (GameType == "Evens/Odds")
            {
                result = Bets.EvenOrOdds(); //Pays 1 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 2);
                }
            }
            if (GameType == "Reds/Blacks")
            {
                result = Bets.RedOrBlack(); //Pays 1 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 2);
                }
            }
            if (GameType == "Lows/Highs")
            {
                result = Bets.LowsOrHighs();//Pays 1 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 2);
                }
            }
            if (GameType == "Dozens")
            {
                result = Bets.Dozens(); //Pays 2 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 3);
                }
            }
            if (GameType == "Columns")
            {
                result = Bets.Columns(); //Pays 2 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 3);
                }
            }
            if (GameType == "Street")
            {
                result = Bets.Street(); //Pays 11 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 12);
                }
            }
            if (GameType == "6 Numbers")
            {
                result = Bets.SixNumbers();//Pays 5 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 6);
                }
            }
            if (GameType == "Split")
            {
                result = Bets.Split(); // Pays 17 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 18);
                }
            }
            if (GameType == "Corner")
            {
                result = Bets.Corner(); //Pays 8 to 1
                if (result == "You won!")
                {
                    Wallet += (bet * 9);
                }
            }
            Console.WriteLine(result);
            return(Wallet);
        }