Wordbrain Solver – 5×5 – Brute-Force v.1

For the Wordbrain Solver for 5×5 puzzles, I have attempted to make a semi-brute force method, checking early for valid words, and discarding useless paths.

This program will find all possible valid words found in a norwegian dictionary.  I have tried to implement skipping of a path-traveling if the first two letter does not exist in my dictionary.

EDIT: 17.april – It seems like none of the filter functions above was working properly. Fixed in next version.

As you will see from the terminal output below, I have calculated all possible paths (but limited to 9 jumps -> 9 character words) from letter ‘l’ to the first 20 letters. This tok around 45 000 seconds, equal to 12.5 hours. 12.5/20 = 0.625 => 0.625*60m. = 37.5 minutes calculation for all possible path between two letters. Having 25 letters needing a path to 24 other letters – 25*24 = 600 letter-to-letter paths. 600 X 37.5min = 22500 min = 375 hours = 15,625 days

Meaning – this is not the optimal algorithm.

My code for making the text file for the dictionary containing first and last letter for all words in Norwegian dictionary.


The not so good code for 5×5 puzzles. Works great for 2×2, 3×3 & 4×4 though.


Facebook Comments