I'm wanting to generate
double word-squares of size 4x4 and 6x6. I've done a little research, but I'm not finding much in way of actual code examples. There are
discussions of double word-squares to be found, but few (none?) with code samples that I could understand. For example,
this one describes an algorithm, but I'm not sure how to implement it in B4X.
If anybody has any ideas (or good links to articles) or some pseudo-code on how to generate these things, please contribute to this thread.
Thank you!
For Four-by-four:
Start with a list of all four-letter words
eg download
https://www.wordgamedictionary.com/sowpods/download/sowpods.txt
and filter to 4-letter words only eg attached file, has 5454 words
Now, I agree that to go through all 5454^4 combinations of 4 horizontal words, and check that each makes 4 vertical words too, is probably going to take longer than you're willing to wait.
But you can shortcut it down - probably what your found algorithm does - by say:
Try each word in the top row, and then try 4 words vertically, beginning with the letters of the top row.
That would reduce the problem from 5454^4 to more like 5454 * (5454/26) ^ 4 = 98.8% reduction
You could reduce it further by trying each word in the top two rows (yeah, yeah, 30 million possibilities) and then try 4 words vertically, beginning with the letters of the top two rows.
Now we're down to 5454^2 * (5454/26^2) ^ 4 = hmm that's still like 126 billion possibilities. ?
Tell you what, have a harder look at that algorithm you found, get back to us if you can't get that going. ?