If (_index2 != -1) // Do letters intersect? if (c._Letter != letters._Letter) Int _index2 = pts.ToList().FindIndex(t => t.X = c.X & t.Y = c.Y) Letter c = Construct(all, current, word, length) įor ( int i = 0 i = length || c.Y = length)įor ( int j = 0 j (t => new Point(t.X, t.Y)).ToArray() Otherwise generation would bring the same results every time! > /p>Ĭopy Code private Letter Next(Letter letters, string word, int length) Please note, the while(list.Count > 0) are there because we don't want to always go in a linear loop. For these methods most of theĮxplanation would be better placed inside the code. These last methods are the core, the seeding and placing. Besides that all we need is some good word placing logic and organization. Oh no! Increase the length of the grid size. This.lastlength = length // Don't forget to set lastlength! this.answers = words.ToArray() // Don't forget to set answer key! this.lastgrid = without // Don't forget to set lastgrid! return Fill(without) // Finially fill the grid with random letters in the empty spots. Finalize Words to grid (Essentially a character grid without answers)Ĭhar without = From(words.ToArray(), length) Remove the word so we don't add it again! Letter next = Next(words.ToArray(), left, length) // We need logic! if (next = null) // No solution? exit loop. While ( true) // Loops until a solution is found, by increasing length each loop Copy Code // Foreach word in words set default length to max // If needed we'll increase later.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |