コード例 #1
0
        public void dealersChoice(int dealersTotalOfFirstDraw)
        {
            Random rnd = new Random();

            if (dealersTotalOfFirstDraw < playersHandTotal)
            {
                int dealersNextCard = 0;
                dealersNextCard = rnd.Next(1, 12);
                Console.WriteLine("Dealer's next card is {0}", dealersNextCard);
                dealersTotalOfFirstDraw += dealersNextCard;
                Console.WriteLine("Dealer's current total is: {0}", dealersTotalOfFirstDraw);
                ScoreCheckDealer(dealersTotalOfFirstDraw);
            }
            else if (dealersTotalOfFirstDraw > playersHandTotal)
            {
                Console.WriteLine("Dealer Wins!!");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.HouseWinning();
            }
            else if (dealersTotalOfFirstDraw == playersHandTotal)
            {
                Console.WriteLine("Tie");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.playAgain();
            }
        }
コード例 #2
0
 public void ScoreCheckPlayer(int playersTotal)
 {
     if (playersTotal >= 22)
     {
         Console.WriteLine("Bust");
         CSharp.Program casinoGame = new CSharp.Program();
         casinoGame.HouseWinning();
     }
     else if (playersTotal == 21)
     {
         Console.WriteLine("BlackJack!!");
         CSharp.Program casinoGame = new CSharp.Program();
         casinoGame.PlayerWinnings();
     }
     else
     {
         PlayerChoices();
     }
 }
コード例 #3
0
 public void ScoreCheckDealer(int dealersTotalOfFirstDraw)
 {
     if (dealersTotalOfFirstDraw >= 22)
     {
         Console.WriteLine("Dealer bust, player wins");
         CSharp.Program casinoGame = new CSharp.Program();
         casinoGame.PlayerWinnings();
     }
     else if (dealersTotalOfFirstDraw == 21)
     {
         Console.WriteLine("BlackJack!! Dealer wins!!");
         CSharp.Program casinoGame = new CSharp.Program();
         casinoGame.HouseWinning();
     }
     else
     {
         dealersChoice(dealersTotalOfFirstDraw);
     }
 }
コード例 #4
0
ファイル: roulette.cs プロジェクト: rlclare92/MajorProjectJSV
        public void playerNumberThgrough()
        {
            input = Console.ReadLine();
            Random rnd     = new Random();
            int    numbers = rnd.Next(0, 38);

            Console.WriteLine("Number is {0}", numbers);
            if (playerInput == numbers)
            {
                Console.WriteLine("You win!!");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.PlayerWinnings();
            }
            else
            {
                Console.WriteLine("You lose");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.HouseWinning();
            }
        }
コード例 #5
0
ファイル: roulette.cs プロジェクト: rlclare92/MajorProjectJSV
        public void playerOddsThrough()
        {
            input = Console.ReadLine();
            Random rnd = new Random();

            string[] odds   = { "Even", "Odd" };
            int      oIndex = rnd.Next(odds.Length);

            Console.WriteLine("{0}", odds[oIndex]);
            if (input == odds[oIndex])
            {
                Console.WriteLine("You win!!");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.PlayerWinnings();
            }
            else
            {
                Console.WriteLine("You lose");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.HouseWinning();
            }
        }
コード例 #6
0
ファイル: roulette.cs プロジェクト: rlclare92/MajorProjectJSV
        public void colourPlayThrough()
        {
            input = Console.ReadLine();
            Random rnd = new Random();

            string[] colours = { "Black", "Red" };
            int      cIndex  = rnd.Next(colours.Length);

            Console.WriteLine("The colour is {0}", colours[cIndex]);
            if (input == colours[cIndex])
            {
                Console.WriteLine("You win!!");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.PlayerWinnings();
            }
            else
            {
                Console.WriteLine("You lose");
                CSharp.Program casinoGame = new CSharp.Program();
                casinoGame.HouseWinning();
            }
        }
コード例 #7
0
        public void PlayerChoices()
        {
            Console.WriteLine("Hit or Stand?");
            input = Console.ReadLine();
            Random rnd = new Random();

            if (input == "Hit")
            {
                playersNextCard = rnd.Next(1, 12);
                Console.WriteLine("Your next card is {0}", playersNextCard);
                playersTotal += playersNextCard;
                Console.WriteLine("Your total is: {0}", playersTotal);
                ScoreCheckPlayer(playersTotal);
                input = Console.ReadLine();
                PlayerChoices();
            }
            else if (input == "Stand")
            {
                playersHandTotal += playersTotal;
                Console.WriteLine("You have stand at {0}, dealers turn", playersHandTotal);
                if (playersTotal >= 22)
                {
                    Console.WriteLine("Bust");
                    CSharp.Program casinoGame = new CSharp.Program();
                    casinoGame.HouseWinning();
                }
                else if (playersTotal == 21)
                {
                    Console.WriteLine("BlackJack!!");
                    CSharp.Program casinoGame = new CSharp.Program();
                    casinoGame.PlayerWinnings();
                }
                Console.Read();
                dealersHand();
            }
        }