Exemplo n.º 1
0
        private string GetUserInput()
        {
            _communicationOperations.WriteLine(
                "Type 4 colors from this range: Red, Blue, Green, Orange, Purple, Yellow, separated with a coma: ','");
            var input = _communicationOperations.Read();

            return(input);
        }
Exemplo n.º 2
0
        public int[,] GetGridState()
        {
            _communicationOperations.WriteLine("Provide initial cell state in the following format:' 0010,1000,1100,000 ' where 1 mean the cell is alive and 0 means cell is dead. ");


            var userAnswer = _communicationOperations.Read();

            var userAnswerArray = userAnswer.Split(',').ToArray();

            var userAnswerAsTwoDArray = new int[userAnswerArray.Length, userAnswerArray.Length];

            for (var i = 0; i < userAnswerArray.Length; i++)
            {
                for (var j = 0; j < userAnswerArray[i].Length; j++)
                {
                    userAnswerAsTwoDArray[i, j] = int.Parse(userAnswerArray[i][j].ToString());
                }
            }

            return(userAnswerAsTwoDArray);
        }