Skip to content

tmelorc/word-search-puzzle

Repository files navigation

word-search-puzzle

A Python tool that creates customizable word search puzzles and exports them using TikZ for high-quality LaTeX typesetting. Includes grid generation, automatic word placement, and optional solution output.

screenshot0 screenshot
  1. Edit the list of words in words.txt
  2. Run python main.py
  3. Run pdflatex main.tex

Note 1. To hide the solutions, comment out the line \input{./game_boards/current.solution} in the main.tex file.

Note 2. The position of each word on the board is random. The script attempts to place each word up to 30 times in random mode. If it fails, the word is skipped. You can change this number by redefining MAXIMAL_NUMBER_OF_TRIES = 30 in variables.py.

Note 3. The data for each game board is saved in the game_boards folder. You can restore an old game simply by copying its data into the current files.

Note 4. To disable pdflatex set PDFLATEX=False on variables.py.

Note 5. You can pass a different word list file as an argument to main.py.

Note 6. You can define the allowed directions by changing the following variables:

NORTH = True
SOUTH = True
EAST = True
WEST = True
DIAGONALS = True

Project structure

word-search-puzzle/
│
├── main.py                 # Main script that generates the puzzle
├── variables.py            # Configuration values (e.g., max attempts)
├── words.txt               # Input word list
├── main.tex                # LaTeX output file
│
├── game_boards/            # Stores generated boards and solutions
│   ├── current.board
│   ├── current.solution
│   └── ...
│
└── macros.tex              # LaTeX/TikZ templates used for rendering

Troubleshooting

Words not appearing

Increase MAXIMAL_NUMBER_OF_TRIES or reduce word count/length.

LaTeX compilation errors

Ensure your TeX distribution includes TikZ and standard packages.

Accents or unicode issues

Prefer uppercase/lowercase ASCII letters in words.txt.

About

A Python tool that creates customizable word search puzzles and exports them using TikZ for high-quality LaTeX typesetting. Includes grid generation, automatic word placement, and optional solution output.

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors