Tag Archives: programming

Wordbrain solver – letter permutations

When you are stuck after partly solving a puzzle, there is a chance that the puzzle is solved in the wrong order. Using my path seeking algorithm might not work, since the letter are in the wrong place in the matrix. The remaining letters are however correct. This is why I made a simple program for finding all possible permutations of the remaining letter, disregarding the location. The program also compares against the Norwegian dictionary. You type in the letters and choose length of the word.

The program uses a library for permutations:

Norwegian dictionary as Python dict format: wordDict.txt

Terminal output:

WordBrain solver – 4×4 – Semi-Brute-Force

This is my solution so far, for semi-brute-force solving of 4×4 WordBrain puzzles.

This program will find all possible valid words found in a norwegian dictionary. This will take around ten minutes (on a 1.2Ghz MacBook). I have tried to implement skipping of a path-traveling if the first two letter does not exist in my dictionary.

I have one idea to make the program a little bit faster. I will make a new Python dict containing the first and last letter from all the words in a norwegian dictionary. This way, checking all possible paths from ‘t to ø’ is skipped, if I know that no norwegian words start with a ‘t’ and ends with an ‘ø’. That should shave some time of the implementation.

One problems shown above. The first run of the program checks every possible route from every letter to every other letter. When solving for the word JOKER above, the letters are rearranged and new paths are formed. Meaning the program have to be run again.

The first round is run with the letters: k1,e1,e2,r1,o1,r2,j,e3,e4,r3,o2,k2,ø,y,s,t

After JOKER rearranged the letters, we kan input the letters again, exchanging all the used letters with a letter not existing in that specific problem. Here we will use ‘x’: k1,e1,x1,x2,o1,r2,x3,x4,e3,r3,e4,x5,ø,y,s,t

This will take another 10 minutes, since we will look for unlikely paths like from ø to x.

The OSX Terminal output: