Exemple #1
0
        public void splashPage()
        {
            Console.WriteLine(" ____________________________________________________________________________________________________________");
            Console.WriteLine(@"|   __          __  _                            _          _   _             _____          _             _ |");
            Console.WriteLine(@"|   \ \        / / | |                          | |        | | | |           / ____|        (_)           | ||");
            Console.WriteLine(@"|    \ \  /\  / /__| | ___ ___  _ __ ___   ___  | |_ ___   | |_| |__   ___  | |     __ _ ___ _ _ __   ___ | ||");
            Console.WriteLine(@"|     \ \/  \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \  | __| '_ \ / _ \ | |    / _` / __| | '_ \ / _ \| ||");
            Console.WriteLine(@"|      \  /\  /  __/ | (_| (_) | | | | | |  __/ | || (_) | | |_| | | |  __/ | |___| (_| \__ \ | | | | (_) |_||");
            Console.WriteLine(@"|       \/  \/ \___|_|\___\___/|_| |_| |_|\___|  \__\___/   \__|_| |_|\___|  \_____\__,_|___/_|_| |_|\___/(_)|");
            Console.WriteLine("|____________________________________________________________________________________________________________|");
            Console.WriteLine("|_______________________________________Enter your name to continue!_________________________________________|");



            GameManager.Name = Convert.ToString(Console.ReadLine());

            switchCase switchCase = new switchCase();

            switchCase.switches();
        }
Exemple #2
0
        public void FiftyFiftyGame()
        {
            int bet;
            int guess;


            int gameFinish;

            Console.Clear();
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine($"New Initiaded! Your current balance is {GameManager.Balance}");
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("How much do you want to bet?");

            bet = Convert.ToInt32(Console.ReadLine());

            //Random generator
            Random random   = new Random();
            int    randomNr = random.Next(1, 3);


            while (bet < 0 || bet > GameManager.Balance)
            {
                Console.WriteLine("Bet is higher than your balance, please try again");
                Console.WriteLine("How much do you want to bet?");
                bet = Convert.ToInt32(Console.ReadLine());
            }


            Console.WriteLine("Your bet is: " + bet);
            Console.WriteLine("..................................................................");
            Console.WriteLine("Pick RED or BLACK ");
            Console.WriteLine("_________________        ___________________");
            Console.WriteLine("|PRESS 1 for RED|        |PRESS 2 for BLACK|");
            Console.WriteLine("|_______________|        |_________________|");
            guess = Convert.ToInt32(Console.ReadLine());


            //Spelare och CPU vinner
            if (guess == randomNr)
            {
                if (randomNr == 1)
                {
                    Console.ForegroundColor
                        = ConsoleColor.Red;
                    Red();
                }
                if (randomNr == 2)
                {
                    Console.ForegroundColor
                        = ConsoleColor.DarkGray;
                    Black();
                }

                else if (guess >= 2)
                {
                    Console.WriteLine("Incorrect input, please try again!");
                    return;
                }

                Console.WriteLine("YOU WIN!");

                GameManager.Balance += bet;
                Console.WriteLine("Current balance is: " + GameManager.Balance
                                  );
                Console.WriteLine("|      | 1 |          |      | 2 |       |");
                Console.WriteLine("| Play 50/50 again!   |    Main menu     |");
                gameFinish = Convert.ToInt32(Console.ReadLine());

                switch (gameFinish)
                {
                case 1:
                    FiftyFiftyGame();
                    break;

                case 2:
                    switchCase switchCase = new switchCase();
                    switchCase.switches();

                    break;


                default:
                    break;
                }
            }
            if (guess != randomNr)
            {
                if (randomNr == 1)
                {
                    Console.ForegroundColor
                        = ConsoleColor.Red;

                    Red();
                }
                if (randomNr == 2)
                {
                    Console.ForegroundColor
                        = ConsoleColor.DarkGray;

                    Black();
                }
                GameManager.Balance -= bet;
                Console.WriteLine("YOU LOST! current balance is: " + GameManager.Balance);
                Console.WriteLine("|      | 1 |          |      | 2 |       |");
                Console.WriteLine("| Play 50/50 again!   |    Main menu     |");

                gameFinish = Convert.ToInt32(Console.ReadLine());

                switch (gameFinish)
                {
                case 1:

                    FiftyFiftyGame();
                    break;

                case 2:
                    switchCase switchCase = new switchCase();
                    switchCase.switches();

                    break;


                default:
                    break;
                }
            }
        }