Finding words in a crosswords (homework assistance)
One of my kids had the following task: find a set of words in the following crosswords: The set of words was given. The crosswords was created by another student, who accidentally might have drawn the wrong letter at the wrong position, which makes the task of finding the given words hard, especially for little kids. After attempting for a while, I decided to give them a hand. Here is a program to help them out: Input: a crosswords and a set of words to look for The code to find a given word in the crosswords is simple, just laborious and tedious: find the match to the first letter, then go into all the 8 possible directions trying to find the rest of the word. If found => success! The interesting part of the problem is to deal with the potential partial matches. To deal with that, take each word and recursively create a set of partial sub-words. The sub-words are created by removing characters from the initial word. Do so in such a way to always start with sub-words...