Exemple #1
0
        private void randomStringCreator()
        {
            int sizeOfBoard = m_Columns * m_Rows;
            int randomIndex = 0;
            var randomChoice = new Random();
            Cell[] board = new Cell[sizeOfBoard];
            char currentLetter = 'A';
            for (int i = 0; i < sizeOfBoard; i++)
            {
                randomIndex = randomChoice.Next(0, sizeOfBoard);

                while (board[randomIndex].GetALetter == true)
                {
                    if (randomIndex == (sizeOfBoard - 1))
                    {
                        randomIndex = -1;  //// Start from the beginning of the Array
                    }

                    randomIndex++; //// Moves to the next index
                }

                board[randomIndex].Letter = currentLetter;

                if (i % 2 != 0)
                {
                    currentLetter++; ////Move to the next char
                }

                from1dTo2d(board);
            }
        }
Exemple #2
0
 private void from1dTo2d(Cell[] i_Board)
 {
     m_Board = new Cell[m_Rows, m_Columns];
     int k = 0;
     for (int i = 0; i < m_Rows; i++)
     {
         for (int j = 0; j < m_Columns; j++, k++)
         {
             m_Board[i, j] = i_Board[k];
         }
     }
 }