dramire83 / CIS_285

CIS_285
0 stars 0 forks source link

Code - symbolChosen method #26

Closed jwood36 closed 1 year ago

jwood36 commented 1 year ago

This logic is a key example of when to use a Do-While; you must have at least one execution performed.

Your current design requires you to support two of the same logic lines if any change is needed.

For my reference:

        private static int symbolChosen()
        {
            Console.WriteLine(" What symbol would you like to use press 8 for 'X' or 9 for 'O'.");
            validInfo = Console.ReadLine();
            isInRange = int.TryParse(validInfo, out playerInput);
            while (!isInRange || playerInput <= 7 || playerInput >= 10)
            {
                Console.Clear();
                welcomeSign();
                playerInput = 0;
                Console.WriteLine(" Invalid entry! ");
                Console.WriteLine(" What symbol would you like to use press 8 for 'X' or 9 for 'O'.");
                validInfo = Console.ReadLine();
                isInRange = int.TryParse(validInfo, out playerInput);
            }
            return playerInput;
        }
dramire83 commented 1 year ago

Changed the logic to allow for easier choice for user to select between "X" and "O" symbols.