Algorithm Solution Approaches for solving Boggle
Algorithm Solution Approaches for solving Boggle
Makefile
and README.md
have detailed instructions on how to run the programs. In both the implementations we have used the ‘Trie’ approach. Tries are generally the efficient way to search for words pruning search space.
The time complexity here is: O(n) where n is the length of the string to be found.
Trie is essentially a tree where each node can have atmost 26 children (values from the alphabet).
It will also contain a boolean field (or) binary field - to indicate if it’s the end letter of a word, or if it’s a prefix.
The root of the Trie, is generally a
General operations in a trie:
The pythonic approach is explained in detail here: Python Walk-Through
The C++ approach is explained in detail here: C++ Walk-Through
Benchmarking analysis findings are documented here: Benchmarking Findings
-std=c++11
and -std=gnu++0x
for building the applications.
please export `LD_LIBRARY_PATH` and if needed include it in `/usr/lib` and `/usr/local/lib`
Using the Boggle Generator
$ cd boggle_cplusplus
$ make generate
$ ./boggle_generator 10
Created boggle board boggle.txt
Using the Boggle Solver
```
$ make solve
g++ -o boggle_solver boggle_solver.cpp -std=gnu++0x
./boggle_solver
………………………………………………………………………………………. 100%
The number of words are: 1,518
The Score is: 3,939
178,590 words parsed in dictionary.txt
Word length limit of 20 characters
100 cubes on the board
Time taken (Nodes checked per ms) :725
Results saved to results.txt
4. Creating the shared library for potential use with Test Harness
This creates the shared library - boggle_solver.so
$ make shared
I have written a simple test-harness for testing my application - `test.cpp`
To compile that with the shared library
$ make test
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/scratch/BoggleGameSolver/boggle_cplusplus/boggle_solver.so
$ sudo cp /home/scratch/BoggleGameSolver/boggle_cplusplus/boggle_solver.so /usr/lib
$ sudo cp /home/scratch/BoggleGameSolver/boggle_cplusplus/boggle_solver.so /usr/local/lib
5. Using the Dummy Test Harness
$ ./test
………………………………………………………………………………………. 100%
The number of words are: 1,518
The Score is: 3,939
178,590 words parsed in dictionary.txt
Word length limit of 20 characters
100 cubes on the board
Time taken (Nodes checked per ms) :726
Results saved to results.txt
#### Running the python application
Steps to run python program
$ cd boggle_python/
$ python3.8 boggle_solver_trie_implementation.py
Sample O/P:
Enter the size of the boggle board 4
The generated board is: [[‘z’, ‘d’, ‘m’, ‘j’], [‘z’, ‘h’, ‘h’, ‘n’], [‘c’, ‘k’, ‘m’, ‘b’], [‘r’, ‘i’, ‘g’, ‘n’]]
The words are: [‘khz’]
The number of words found are: 1
```
1.http://boardgamegeek.com/thread/300883/letter-distribution
doxygen
, xslt
(or) Sphinx