My Grid algorithms are pretty much finished. I’ll share some word count statistics that I found while running my test functions.
I’m generating the initial Grid iteratively, as I described in the previous post. For a typical game grid(7×6):
- I needed to iterate 10-48 times !!! (one English grid took 1873 iterations)
- The algorithm removed 90-300 words during the process !!! (the English grid removed 32183 words)
- That process is taking roughly 20ms.
Not really efficient, but its a one time computation at the initialization of the grid, who cares. After the init, we have a nice grid without any word directly formed (see at the end of the post).
Then, I coded a function to gather all the valid words found for every possible letter swap !
- Approximately 2500 potential words for a (7×6) grid
- Valid words out of these 2500 words: 8-60 !!!
- Timing: 5 ms
A French Grid containing 36 words:
e q p e y i u a n t o e m q l t c i q g e d t i q l q d t d x q t d r g j n a s i n
An English Grid containing 48 words:
h d t k h s e x g h h m j l i d n r i i g y r y i q h w l d y t y h u n r t i h d c
I don’t have the solution, I didn’t output it to my console, but I could generate it on your request