Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1018 Bytes

README.md

File metadata and controls

21 lines (16 loc) · 1018 Bytes

crossword generator

An AI to generate crossword puzzles.

Given the structure of a crossword puzzle (i.e., which squares of the grid are meant to be filled in with a letter), and a list of words to use, the problem becomes one of choosing which words should go in each vertical or horizontal sequence of squares. We can model this sort of problem as a constraint satisfaction problem. Each sequence of squares is one variable, for which we need to decide on its value (which word in the domain of possible words will fill in that sequence).

$ python generate.py data/structure1.txt data/words1.txt output.png
██████████████
███████M████R█
█INTELLIGENCE█
█N█████N████S█
█F██LOGIC███O█
█E█████M████L█
█R███SEARCHV█
███████X████E█
██████████████