r/dailyprogrammer • u/oskar_s • Jul 16 '12
[7/16/2012] Challenge #77 [difficult] (Boggle solver)
Write a program that is able to find all words in a Boggle board. For a word list, you can use this file.
How many words can you find in the following 10x10 Boggle board?
T N L E P I A C N M
T R E H O C F E I W
S C E R E D A M E A
A O M O G O O F I E
G A C M H N L E R X
T D E R J T F O A S
I T A R T I N H N T
R N L Y I V S C R T
A X E P S S H A C F
I U I I I A I W T T
- Thanks to Medicalizawhat for suggesting this problem (and to Cosmologicon for providing a word list and some commentary) at /r/dailyprogrammer_ideas! If you have a problem that you think would be good for us, why not head over there and suggest it?
11
Upvotes
View all comments
Show parent comment
1
u/Cosmologicon 2 3 Jul 16 '12
Yeah, I found brute force to be plenty fast for this problem, as long as you stop when you can't possibly form a word. While there are on the order of 100x8N-1 N-letter words potentially in the grid, you don't need to explore anywhere near that many paths in general. The vast majority of 3-character sequences are not prefixes of any word in the word list.