This is a brute-force-ish solver for games such as Boggle, Ruzzle or WordBubbles which require the player to traverse a grid of letters to form words without visiting the same letter twice.
- You will need a word list of some sort! Any list of words will do and some Linux distributions provide one by default (check somewhere like
/usr/share/dict/words
). - A modern Java
Building ought to be nice and simple:
$ javac main.java
This should build all the relevant files in the project...
First create a text file with the grid and save it as, for example, grid.txt
. If you need to include blanks then use a space
character. You can, optionally, include a line starting with a # which has a list of word lengths to look for. For example:
# 6 7
tz p
deak
mssm
apt
Then invoke the solver:
$ java main /path/to/wordlist <grid.txt
This should output a list of words :-)
On my pretty old and crusty machine (1.6GHz Intel Atom) it runs in a couple of seconds:
$ time java main /stuff/dicts/twl06 <grid.txt
passed
passed
pampas
pampas
demast
massed
massed
smazes
spasmed
massed
massed
passed
passed
real 0m2.254s
user 0m2.144s
sys 0m0.172s