public WordSquare(WordSquare source)
 {
     Size  = source.Size;
     Lines = new string[Size];
     Array.Copy(source.Lines, Lines, source.Lines.Length);
     Repository = source.Repository;
 }
        public int CalculateScore(WordSquare wordSquare)
        {
            int total = 0;

            foreach (string usedWord in wordSquare.Lines)
            {
                total += CalculateScore(usedWord);
            }

            return(total);
        }
 public void AddWordSquare(WordSquare wordSquare, DateTime dateTweeted)
 {
     foreach (string word in wordSquare.Lines)
     {
         int daysSinceLastUse = (DateTime.Now - dateTweeted).Days;
         if (!DaysSinceLastUse.ContainsKey(word))
         {
             DaysSinceLastUse.Add(word, daysSinceLastUse);
         }
         else
         {
             int previousDaysSinceLastUse = DaysSinceLastUse[word];
             if (daysSinceLastUse < previousDaysSinceLastUse)
             {
                 DaysSinceLastUse[word] = daysSinceLastUse;
             }
         }
     }
 }
        public static List <WordSquare> ReadAllWordSquaresFromFile(string fileWithMagicWordSquares, int size = 5)
        {
            var allWordSquaresFromFile = new List <WordSquare>();

            string[] lines                = File.ReadAllLines(fileWithMagicWordSquares);
            int      lineCount            = lines.Length;
            int      linesInFilePerSquare = size + 1;
            int      availableSquareCount = lineCount / linesInFilePerSquare;

            for (int squareIndex = 0; squareIndex < availableSquareCount; squareIndex++)
            {
                var squareToAdd = new WordSquare(new string('_', size));
                for (int offset = 0; offset < size; offset++)
                {
                    string lineToSet = lines[(squareIndex * linesInFilePerSquare) + 1 + offset];
                    squareToAdd.SetWordAtIndex(lineToSet, offset);
                }
                allWordSquaresFromFile.Add(squareToAdd);
            }


            return(allWordSquaresFromFile);
        }