コード例 #1
0
        //This method occurs every time the ThePlayer loses, it takes out the Wagered amount from the ThePlayer's
        //Money and checks if they have enough Money to keep playing.
        public void ThePlayerLost()
        {
            ThePlayer p = new ThePlayer();

            ThePlayer.Money -= ThePlayer.Wager; //the new money amount =money amount-money lost
            Console.WriteLine($"You lost, you now have ${ThePlayer.Money} left.");
            Console.WriteLine("Press enter...");
            if (ThePlayer.Money <= 0) //if statement to control if user can keep playing with funds
            {
                Console.WriteLine("No cash!\nTry again...");
                Console.ReadLine();
                p.StartGame();
            }
        }
コード例 #2
0
        static void Main()
        {
            ThePlayer   thePlayer   = new ThePlayer();
            DisplayMenu displayMenu = new DisplayMenu();

            try
            {
                thePlayer.StartGame();
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }