Exemple #1
0
        /// <summary>
        /// Attempt to add a word to the solution list
        /// </summary>
        /// <param name="soln">The completed partial solution</param>
        /// <returns>True if it's a new solution, false if it's already been found</returns>
        public static bool AddWord(PartialSoln soln)
        {
            String fullWord = String.Empty;

            foreach (String word in soln.Words)
            {
                fullWord += word + " ";
            }
            return(AddWord(fullWord));
        }
Exemple #2
0
 /// <summary>
 /// A constructor which copies across the list of words from another partial solution
 /// </summary>
 /// <param name="prevSoln">The other solution to copy values from</param>
 public PartialSoln(PartialSoln prevSoln)
 {
     if (prevSoln == null)
     {
         Words = new List <string>();
     }
     else
     {
         Words = new List <string>(prevSoln.Words);
     }
 }
Exemple #3
0
 /// <summary>
 /// Convenience constructor used when you have a previous partial solution and a word to add at the same time.
 /// </summary>
 /// <param name="prevSoln">The partial solution to copy across</param>
 /// <param name="nextWord">The word to add</param>
 public PartialSoln(PartialSoln prevSoln, String nextWord) : this(prevSoln)
 {
     Words.Add(nextWord);
 }