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.3.tar.gz (4.2 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.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: puzzlecreator-1.1.3.tar.gz
  • Upload date:
  • Size: 4.2 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.3.tar.gz
Algorithm Hash digest
SHA256 495703cabb60bc856bc7bb60660c2a17aada7d3667873e51deede8be01f750d4
MD5 e8e8cb665663e66f6a6e025583f19ad1
BLAKE2b-256 08fd72a7bc840b92559febf168ea8ef4141ab79b15ebca8c1d793635bf9f60c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puzzlecreator-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3c7f1db8c5da4514ba4a4cf05bf9680147d39ff70662862af11015596fbc61e6
MD5 ee91ce9446ec8605ecf9dad81ad96418
BLAKE2b-256 ab4c4ff99ff708d4eab8615393a20b2b0cc5216ad6eb728274d36947954f6b49

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