//Create a deep copy of the list. public WordDataList getCopy() { WordDataList deepCopiedList = new WordDataList(); foreach (WordData word in words) { string text = word.Text; int length = word.Length; WordData copiedWord = new WordData(text, length); deepCopiedList.addWord(copiedWord); } return(deepCopiedList); }
//Constructor. public CrozzleGrid(int rowSize, int columnSize, int difficulty) { char[,] arrGameBoard = new char[rowSize, columnSize]; crozzleMap = new CrozzleMap(rowSize, columnSize); this.rowSize = rowSize; this.columnSize = columnSize; totalScore = 0; wordsInGridCount = 0; this.difficulty = difficulty; //List of words in the grid. wordsInGrid = new WordDataList(); //Create new board. crozzleGrid.Add(arrGameBoard); }