Word Search Algorithm Available

Posted Sun Oct 28 @ 02:20:39 PM PDT 2012

I published my word search algorithm on github. I have yet to build a website based on it though. I hope no one beats me to it.

In my earlier post about the algorithm, I mentioned how easy it was to build...except detecting and eliminating badwords. Because my competitor has a badword filter, I needed one too.

What makes a badword filter so hard is that simply detecting a badword is not enough. You have to make sure that the badword is not a substring of another word (like "ass" in "assessment"). Once you find the badword, there are two cases to consider:

  1. The badword is formed only by real words in the word search. For example, notice how "ASS" is formed on the diagonal from the words APE, SAD and SOUP?
    In this case, you have to take one of those words, and move it somewhere else, fill in the blanks with random letters, and check again for badwords.
  2. In the easy case, the badword has a letter in it that was randomly chosen. Replace all those random letters with new random letters, and check again for badwords

It takes a lot of code to do that too. The majority of the code in the algorithm is dedicated just to that.

<< Home