# Word search puzzles

I saw the entry Solving word search puzzles and I wonder if it is possible to:

1. Search for words that exist not only in diagonals but that turn like a snake (left, right, up, down)?

2. Search for all the possible words in the matrix that exist in a known dictionary?

I am trying to understand the solutions given there, I always wish there were more explanations in the solutions for those of us that are not really savvy.

• Perhaps I'm just not clever enough, but I think the combinatorics of what you propose are likely to be intractable. If I'm right about that, the solution would have to take an AI approach, which would make it too broad a topic for this site. Jun 8, 2017 at 13:56
• Jun 8, 2017 at 14:10
• Thank you. Yes, i saw The Boggle post and that is the one I referred to. I understand the answer about using AI. What about the second question? Checking whether words in a (small) dictionary can be hidden in the graph? Suppose the small dictionary is a list with words (mathematica, chair, ... <<50>> table).
– JSP
Jun 8, 2017 at 14:51
• Here is an outline of a possible solution: 1) Make a grid graph of the word matrix. 2) Find all simple paths. 3) Make a prefix tree of the paths. 4) Using the paths prefix tree try to match prefixes in a given dictionary, and 4.1) when a non-matching prefix is found drop the corresponding tree branch. 5) Proceed with 4) until only dictionary-valid root-to-leaf paths are in the tree. Jun 8, 2017 at 15:21
• #Anton Antonov I have made a grid graph of the matrix but I do not know how to find a simple path. I have read in the Help about Path but I cannot imagine that you are suggesting that I should draw by hand all the small arrows between all adjacent cells!? Of course not, but would you please give me a pointer on how to start fetching all the simple paths. Thank you.
– JSP
Jun 8, 2017 at 17:20