![]() ![]() ![]() If there is no previous word, fail (because the words cannot all fit on the grid).If the word fails to fit anywhere on the grid, backtrack and try from step #2 with the previous word.Add it to a random location in the grid.The core of the algorithm (after deciding on the word list and the size of the puzzle grid) is just this: (Bonus: the letters left after finding all the words spell out one of my favorite features of Ruby…) It generates puzzles that look like this: ![]() After spending ten minutes looking online and being fairly disappointed in the quality of what we found, I decided to take a stab at writing a word search puzzle generator myself.įortunately for me it wasn’t too hard at all, though I’m sure my implementation is far from optimal. My daughter (age 11) was writing an article this week for a local student newsletter, and had the idea to include a word search puzzle. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |