Beispiel #1
0
        private void PopulateLetters(string[,] matrix, ILetterLookupSvc letter)
        {
            var horizontalIndex = (int)(matrix.GetLength(0) / 2);

            var verticalIndex = 0;

            matrix[verticalIndex, horizontalIndex] = "A";

            var verticalIndexBottom = (matrix.GetLength(1) - 1);

            matrix[verticalIndexBottom, horizontalIndex] = "A";

            var letters = letter.MatrixLetters;

            for (int i = 1; i < letter.MatrixLetters.Length; i++)
            {
                verticalIndex += 1;
                var selectedLetter = letters[i];
                matrix[verticalIndex, (horizontalIndex - i)] = selectedLetter;
                matrix[verticalIndex, (horizontalIndex + i)] = selectedLetter;

                verticalIndexBottom -= 1;
                matrix[verticalIndexBottom, (horizontalIndex - i)] = selectedLetter;
                matrix[verticalIndexBottom, (horizontalIndex + i)] = selectedLetter;
            }
        }
        public string[,] Start(ILetterLookupSvc letter)
        {
            var letterLookup = letter;
            var letterIndex  = letterLookup.ChosenLetterAlphabetIndex;
            var blankMatrix  = new DiamondMatrix(letterIndex);
            var matrix       = blankMatrix.Matrix;

            _matrixPopulator.PopulateMatrix(matrix, letter);

            return(matrix);
        }
Beispiel #3
0
 public void PopulateMatrix(string[,] matrix, ILetterLookupSvc letter)
 {
     PopulateBlanks(matrix);
     PopulateLetters(matrix, letter);
 }