Skip to content

Solving the kayak crossword puzzle with code.

Notifications You must be signed in to change notification settings

vigneshwerv/kayak

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Kayak puzzle

So I saw this funny word search on the internet that was composed only of letters K, A and Y. The point of the word search was to find the word KAYAK. Seemingly impossible and the author disclosed that the word KAYAK appears in the glyphs matrix only once.

After I spent a couple of minutes solving the puzzle I figured it would be interesting to write a program to solve the puzzle for me, since I've never done any OCR before, and wanted to try it.

An image of the KAYAK word search

How did I proceed

The very first step was to remove the title and help text from the word search so it could be processed by the program without distractions. I've done this using Mac OS X's Preview.app. Here's the image after cropping:

The cropped image

Then, using OpenCV I separated individual glyphs into a matrix, storing each glyph on index according to its position in the glyphs matrix on the image.

After that, I initialized Artificial Neural Network with following topology: 9 inputs, 5 neurons in one hidden layer and one output. I resized each glyph into 3x3 pixel matrix, each pixel corresponding to one input and selected 3 glyphs for training the ANN.

After the ANN was trained I could predict each individual glyph and get ASCII code instead. Once predicted, it was relatively straightforward to search for the string. Here's an image of the output image after search has been done:

A matched KAYAK word

Implementation

The implementation can be seen in the main.cpp file. The code is messy and not very clear but hopefully you'll find it useful.

About

Solving the kayak crossword puzzle with code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.3%
  • CMake 1.7%