Crossword Puzzle Generation Algorithm

  • #1
146
2
Hey all, for a dictionary app I have to code I have to implement as crossword game as a side feature, unfortunately this is compulsory, I can't figure out a good way of finding words that intersect each other (esp words that intersect multiple others) without a hell of a lot of goto and while's. Is there a good, inexpensive strategy (so no genetic algorithms or pure bruteforce) given a list of words, to find good intersections to procedural generate the crossword without while loops that may not even be guaranteed to resolve themselves? Any help appreciated.
 

Answers and Replies

  • #3
146
2
Thanks but that's just abstracting the loop, I'm certain the key lies in pre-processing the data.
 
  • #4
Svein
Science Advisor
Insights Author
2,188
726
You could, of course, put all the words in a database:
  • Word
  • Dictionary entry
  • Word length
  • First letter
  • (Second letter etc.)
Now you have pre-processed the data. In order to find the word you want, create a query incorporating the word length and known letters...
 
  • Like
Likes harborsparrow
  • #6
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2020 Award
18,620
10,271
Hey all, for a dictionary app I have to code I have to implement as crossword game as a side feature, unfortunately this is compulsory, I can't figure out a good way of finding words that intersect each other (esp words that intersect multiple others) without a hell of a lot of goto and while's. Is there a good, inexpensive strategy (so no genetic algorithms or pure bruteforce) given a list of words, to find good intersections to procedural generate the crossword without while loops that may not even be guaranteed to resolve themselves? Any help appreciated.

Transform code to produce a crossword (7 letters).

compile
 

Related Threads on Crossword Puzzle Generation Algorithm

  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
8
Views
859
Replies
0
Views
4K
Replies
5
Views
1K
  • Last Post
Replies
8
Views
1K
  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
13
Views
1K
Top