示例#1
0
        /// <summary>
        /// Gets the number of colors to use in the secret code.
        /// </summary>
        public static int GetNumberOfColors()
        {
            var maximumColors = Colors.List.Length;
            var colors        = 0;

            while (colors < 1 || colors > maximumColors)
            {
                colors = GetInteger(View.PromptNumberOfColors);
                if (colors > maximumColors)
                {
                    View.NotifyTooManyColors(maximumColors);
                }
            }

            return(colors);
        }