Skip to main content

A package for creating crossword puzzles by Orchid Box.

Project description

Puzzle Creator

A Python package for creating crossword puzzles.

Creator is Frank Vitetta

CEO and Founder of Orchid Box Agency

Installation

You can install the package using pip: pip install puzzlecreator

Usage

from puzzlecreator import crossword

word_list = ["GAME", "BR", "PEALED", "KILLS", "SHOP", "FIG", "PAW", "PUFFED", "BULLET", "MOLLIFY", "KIDS"]

max_time = 5 # Number of seconds to find the most efficient combination

result = crossword.repeated_word_placement(word_list, max_time=5)

crossword.print_crossword(result)

F I G A M E #
F D P B R # #
E S E U # # #
D H A L K # #
M O L L I F Y
# P E E L # #
# # D T L # #
# # # # S # #
P A W # # # #
U K # # # # #

Get Word Positions

from puzzlecreator import crossword

#Define a list of words to include in the crossword

word_list = ["GAME", "BR", "PEALED", "KILLS", "SHOP", "FIG", "PAW", "PUFFED", "BULLET", "MOLLIFY", "KIDS"]

#Generate the crossword puzzle

result = crossword.repeated_word_placement(word_list, max_time=5)

#Get positions of the words in the crossword with correct numbering positions_across, positions_down = crossword.get_ordered_word_positions_with_numbers(result, word_list)

print("Across:", positions_across)

print("Down:", positions_down)

Across: {'FIG': [(1, 1), 1], 'GAME': [(3, 1), 2], 'BR': [(4, 2), 4], 'MOLLIFY': [(1, 5), 6], 'PAW': [(1, 9), 8]}
Down: {'SHOP': [(2, 3), 3], 'PEALED': [(3, 2), 5], 'BULLET': [(4, 2), 4], 'KILLS': [(5, 4), 7]}

Remove Letters from Crossword

from puzzlecreator import crossword

#Define a list of words to include in the crossword

word_list = ["GAME", "BR", "PEALED", "KILLS", "SHOP", "FIG", "PAW", "PUFFED", "BULLET", "MOLLIFY", "KIDS"]

#Generate the crossword puzzle

result = crossword.repeated_word_placement(word_list, max_time=5)

#Generate the crossword puzzle

result = crossword.repeated_word_placement(word_list, max_time=5)

#Get positions of the words in the crossword with correct numbering positions_across, positions_down = crossword.get_ordered_word_positions_with_numbers(result, word_list)

#Print numbered empty crossword print("\nNumbered Crossword without letters:")

crossword.print_numbered_empty_crossword(result, positions_across, positions_down)

Crossword without letters:
1 _ 2 _ _ _ #
# # 5 4 _ # #
# 3 _ _ # # #
# _ _ _ 7 # #
6 _ _ _ _ _ _
# _ _ _ _ # #
# # _ _ _ # #
# # # # _ # #
8 _ _ # # # #
# # # # # # #

Algo Explanation

  1. Intersection Points: Finds potential intersection points where new words can intersect with existing ones.
  2. Placement Scoring: Evaluates each potential placement based on how well it intersects with existing words and the overall compactness of the crossword grid.
  3. Best Placement Selection: Iterates over possible placements for each word, selects the best one based on the score, and updates the grid accordingly.
  4. Multiple Attempts: Generates multiple crossword puzzles within a given time frame (5 seconds is default) and selects the best one based on the scoring criteria.
  5. Trimming the Grid: Before printing, removes any empty rows or columns to ensure a more compact grid.
  6. Result Printing: The final crossword grid is printed with words intersecting properly, and empty spaces are filled with dots (’#’).
pip install puzzlecreator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

puzzlecreator-1.1.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

puzzlecreator-1.1.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file puzzlecreator-1.1.4.tar.gz.

File metadata

  • Download URL: puzzlecreator-1.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for puzzlecreator-1.1.4.tar.gz
Algorithm Hash digest
SHA256 1f9cc9e6bced9b26751ba4d300f06ae5e487d9100f15ea5991cf91fc73f5e8f2
MD5 bd6798d224e480bc6887f9795e7e8da8
BLAKE2b-256 a3530a144adf93538f6565b2982d703e0c077805489e5499d7b5bca2d7ef2ad5

See more details on using hashes here.

File details

Details for the file puzzlecreator-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: puzzlecreator-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for puzzlecreator-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 acad9e76a8ab064e2403c42374c3e00a5d4c3858393fda71d8646fb709928e5f
MD5 b400c4afd548fd603d58dd6a5e5466b2
BLAKE2b-256 d982d1717c6cac6fa6692231cc675b9b989f30da9924dd0439ad9bd78817ca79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page