Пример #1
0
        /// <summary>
        /// Spins the wheel and asks the user to make a guess.
        /// </summary>
        private void Spin(Player playerOne)
        {
            int wheelAmount = wheel.WheelSpin();

            ui.DisplayWheelAmount(wheelAmount);

            if (wheelAmount > 0)
            {
                char spinGuessLetter = ui.GetSpinGuessLetter(phraseBoard);

                //if the phrase contains the character, the program tells the user of this and tell them how much they won.
                //It then goes back to the spin or solve function.
                int pointsEarned = phraseBoard.MakeGuess(wheelAmount, spinGuessLetter);
                if (pointsEarned > 0)
                {
                    ui.DisplaySpinGuessLetterSuccess(spinGuessLetter, pointsEarned);
                    playerOne.AddCurrentScore(pointsEarned);
                }
                //if it does not contain the character, it tells the user it has not have it and to guess again.
                //It then goes back to the spin or solve function.
                else
                {
                    ui.DisplaySpinGuessetterFailure(spinGuessLetter);
                }
            }
            else
            {
                ui.DisplayLoseTurn();
            }
        }
Пример #2
0
        /// <summary>
        /// Spins the wheel and asks the user to make a guess.
        /// </summary>
        private void Spin(Player playerOne, out bool turnOver)
        {
            int wheelAmount = wheel.WheelSpin();

            ui.DisplayWheelAmount(wheelAmount);

            // If the player spins a value of LOSE A TURN or BANKRUPTCY, there turn is over...
            switch (wheelAmount)
            {
            case Wheel.LoseATurn:
                turnOver = true;
                return;

            case Wheel.Bankruptcy:
                turnOver = true;
                playerOne.DeductCurrentScore(playerOne.TurnScore);
                return;

            default:
                break;
            }

            // Spin was good, so Ask the user to guess a letter
            char spinGuessLetter = ui.GetSpinGuessLetter(phraseBoard, playerOne);

            //if the phrase contains the character, the program tells the user of this and tell them how much they won.
            //It then goes back to the spin or solve function.
            int pointsEarned = phraseBoard.MakeGuess(wheelAmount, spinGuessLetter);

            if (pointsEarned > 0)
            {
                ui.DisplaySpinGuessLetterSuccess(spinGuessLetter, pointsEarned);
                playerOne.AddCurrentScore(pointsEarned);
                turnOver = false;
                return;
            }
            //if it does not contain the character, it tells the user it has not have it and to guess again.
            //It then goes back to the spin or solve function.
            else
            {
                ui.DisplaySpinGuessetterFailure(spinGuessLetter);
                turnOver = true;
                return;
            }
        }
Пример #3
0
        /// <summary>
        /// Spins the wheel and asks the user to make a guess.
        /// </summary>
        private void Spin(Player playerOne, out bool turnOver)
        {
            int wheelAmount = wheel.WheelSpin();

            ui.DisplayWheelAmount(wheelAmount);

            // The wheel landed at lose a turn, user turn ends
            if (wheelAmount == Wheel.LoseATurn)
            {
                ui.DisplayLoseTurn();
                turnOver = true;
                return;
            }

            if (wheelAmount == Wheel.LoseATurn)
            {
                turnOver = true;
                return;
            }

            // Ask the user to guess a letter
            char spinGuessLetter = ui.GetSpinGuessLetter(phraseBoard, playerOne);

            //if the phrase contains the character, the program tells the user of this and tell them how much they won.
            //It then goes back to the spin or solve function.
            int pointsEarned = phraseBoard.MakeGuess(wheelAmount, spinGuessLetter);

            if (pointsEarned > 0)
            {
                ui.DisplaySpinGuessLetterSuccess(spinGuessLetter, pointsEarned);
                playerOne.AddCurrentScore(pointsEarned);
                turnOver = false;
                return;
            }
            //if it does not contain the character, it tells the user it has not have it and to guess again.
            //It then goes back to the spin or solve function.
            else
            {
                ui.DisplaySpinGuessetterFailure(spinGuessLetter);
                turnOver = true;
                return;
            }
        }
Пример #4
0
        /// <summary>
        /// Spins the wheel and asks the user to make a guess.
        /// </summary>
        public static void Spin()
        {
            int wheelAmount = wheel.WheelSpin();

            Console.WriteLine("The wheel landed at ${0}", wheelAmount);

            if (wheelAmount > 0)
            {
                Console.Write("Guess a letter: ");
                string spinGuess       = Console.ReadLine().ToLower();
                char   spinGuessLetter = SingleLettersOnly(spinGuess);

                //If the character has already been guessed, then it will prompt the user to type in one that has not.
                while (phraseBoard.HasGuessed(spinGuessLetter))
                {
                    Console.Write("{0} has already been guessed. Guess again: ", spinGuessLetter);
                    spinGuess       = Console.ReadLine().ToLower();
                    spinGuessLetter = SingleLettersOnly(spinGuess);
                }

                //if the phrase contains the character, the program tells the user of this and tell them how much they won.
                //It then goes back to the spin or solve function.
                int pointsEarned = phraseBoard.MakeGuess(wheelAmount, spinGuessLetter);
                if (pointsEarned > 0)
                {
                    Console.WriteLine("The phrase indeed includes {0}. You won ${1}!", spinGuessLetter, pointsEarned);
                    playerOne.AddCurrentScore(pointsEarned);
                }
                //if it does not contain the character, it tells the user it has not have it and to guess again.
                //It then goes back to the spin or solve function.
                else
                {
                    Console.WriteLine("The phrase does not include {0}. Try again next turn!", spinGuessLetter);
                }
            }
            else
            {
                Console.WriteLine("Sorry, you lose a turn");
            }
        }