Exemple #1
0
        /// <summary>
        /// Starts the executions of the Wheel of Fortune console app game
        /// </summary>
        public void Start()
        {
            playerOne = new Player(ui.GetPlayerName());
            ui.DisplayWelcomeMessage(playerOne);

            while (!phraseBoard.IsGameOver())
            {
                ui.DisplayPlayerScore(playerOne);
                ui.DisplayBoard(phraseBoard);

                if (ui.GetUserChoice() == 1)
                {
                    Spin(playerOne);
                }
                else
                {
                    Solve(playerOne);
                }
            }

            ui.DisplayPlayerScore(playerOne);
            ui.DisplayBoard(phraseBoard);
            ui.DisplayWinner(playerOne);

            ui.GetExit();
        }
Exemple #2
0
        /// <summary>
        /// Starts the executions of the Wheel of Fortune console app game
        /// </summary>
        public void Start()
        {
            //playerOne = new Player(ui.GetPlayerName());
            foreach (string playerName in ui.GetPlayerNames())
            {
                players.Add(new Player(playerName));
            }
            int currentPlayer = 0;
            int roundWinner   = 0;

            ui.DisplayCat(catphrase);
            ui.DisplayWelcomeMessage(players);

            while (!phraseBoard.IsGameOver())
            {
                if (players.Count > 1)
                {
                    ui.SetPlayerTextColor(currentPlayer);
                    ui.DisplayPlayerTurn(players[currentPlayer]);
                }

                TakeTurn(players[currentPlayer], phraseBoard);

                // check to see if the current player won the game
                if (phraseBoard.IsGameOver())
                {
                    roundWinner = currentPlayer;
                }

                // advance to the next player
                currentPlayer = (currentPlayer + 1) % players.Count;
            }

            ui.ResetTextColorToWhite();

            ui.DisplayBoard(phraseBoard);
            ui.DisplayWinner(players, roundWinner);

            ui.GetExit();
        }
Exemple #3
0
        /// <summary>
        /// The current player takes their turn until they guess incorrectly, solve the puzzle, por spin Lose-A-Turn
        /// </summary>
        /// <param name="playerOne"></param>
        /// <param name="phraseBoard"></param>
        private void TakeTurn(Player playerOne, PhraseBoard phraseBoard)
        {
            bool turnOver;

            do
            {
                ui.DisplayPlayerScore(playerOne);
                ui.DisplayBoard(phraseBoard);

                if (ui.GetUserChoice() == 1)
                {
                    Spin(playerOne, out turnOver);
                }
                else
                {
                    Solve(playerOne, out turnOver);
                }
            } while (!(turnOver || phraseBoard.IsGameOver()));
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Console.Write("Please enter your name: ");
            string name = Console.ReadLine();

            playerOne = new Player(name);

            Console.WriteLine("Welcome to Wheel of Azure {0}!", playerOne.Name);
            while (!phraseBoard.IsGameOver())
            {
                Console.WriteLine("Total Score: ${0} ", playerOne.TurnScore);
                phraseBoard.DisplayBoard();
                bool isNumeric = false;
                int  userChoice;
                do
                {
                    Console.WriteLine("Enter 1 to Spin, or 2 to Solve");
                    string choice = Console.ReadLine();
                    isNumeric = int.TryParse(choice, out userChoice);
                } while (!isNumeric || (userChoice != 1 && userChoice != 2));

                phraseBoard.DisplayBoard();
                if (userChoice == 1)
                {
                    Spin();
                }
                else
                {
                    Solve();
                }
            }
            Console.WriteLine("Total Score: ${0} ", playerOne.TurnScore);
            phraseBoard.DisplayBoard();
            Console.WriteLine("You win! Press enter to exit.");
            Console.ReadLine();
        }