Ejemplo n.º 1
0
        /// <summary>
        /// method to tell users who is X and who is O, draws initial board
        /// </summary>
        public static void WelcomeMessage()
        {
            Console.Clear();
            GameBoard NewGame = new GameBoard();

            NewGame.DrawBoard(NewGame.NewBoard);
            Console.WriteLine($"{playerOneName} is X.");
            Console.WriteLine($"{playerTwoName} is O.");
            Console.WriteLine("Press any key to begin.");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// method to create new users, assign user input to name variable
        /// </summary>
        public static void CreatePeople()
        {
            Console.Clear();
            GameBoard NewGame   = new GameBoard();
            Game      CheckGame = new Game();

            NewGame.DrawBoard(NewGame.NewBoard);
            Person playerOne = new Person();
            Person playerTwo = new Person();

            playerOne.playerMark = "X";
            playerTwo.playerMark = "O";

            Console.WriteLine("Player One, please enter your name.");
            try
            {
                playerOneName = Console.ReadLine();
                if (playerOneName == "" || playerOneName == null)
                {
                    throw new FormatException();
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("Please enter valid input.");
            }

            Console.WriteLine("Player Two, please enter your name.");
            try
            {
                playerTwoName = Console.ReadLine();
                if (playerTwoName == "" || playerTwoName == null)
                {
                    throw new FormatException();
                }
            }
            catch (FormatException)
            {
                Console.WriteLine("Please enter valid input.");
            }
        }