Beispiel #1
0
        public IPlayer Create(int No)
        {
            var type = SelectType(No);

            if (type == PlayerType.Human)
            {
                string input;
                do
                {
                    input = _messageService.ReadPlayerName(No);
                } while (String.IsNullOrEmpty(input) || input.Length > 10);

                return(new Human(_turnService)
                {
                    Name = input
                });
            }

            if (type == PlayerType.Computer)
            {
                return(new Computer(_turnService)
                {
                    Name = _nameService.GetNewRandomName(syllables)
                });
            }

            return(null);
        }