Monday, September 14, 2015

Word Search




Here is a Word Search application that I wrote.  You can keep it simple and just key in the words you want to use for the Word Search or you can get fancy and control the settings below:

  • Shape - the shape of the puzzle
  • Directions - which way the words should flow
  • Case - uppercase vs lowercase
  • Filler - what characters to place in the gaps
  • Solution - whether to show or hide the solution
  • Order - whether or not to alphabetize to word list
  • List - show the word list beside or below

This is a windows application (an EXE) and is not a website or browser app.

While there are many applications and websites that will already do this for you, I created this one to solve a developer challenge that has bugged me some time.  Programmatically, what is the best way to fit words into a box and not overlay existing words?

The program is really just a series of nested loops.
Make several attempts to find a place for all the words
  For each word
    For each position in the puzzle (until you find a match)
      For each direction (until you find a match)
        For each letter in the current word
          Place the letter in the spot 
            if the spot is not already taken
            (otherwise try the next direction or position)

The code is a C# .NET Windows Application made with Visual Studio 2012.  If you are interested, you can download the source code.

No comments:

Post a Comment