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)

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

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

positions = crossword.get_word_positions(result, word_list) print("Positions:", positions)

Positions: {'GAME': (1, 1), 'BR': (2, 2), 'PEALED': (5, 3), 'KILLS': (1, 4), 'SHOP': (2, 5), 'FIG': (6, 2), 'PAW': (2, 3), 'PUFFED': (1, 6), 'BULLET': (3, 1),

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)

#Remove letters from the crossword

empty_crossword = crossword.remove_letters_from_crossword([row[:] for row in result])

print("Crossword without letters:")

crossword.print_crossword(empty_crossword)

Crossword without letters:
_ _ _ _ # #
_ _ _ _ _ _
_ _ _ _ _ _
_ _ _ _ _ _
# _ _ _ _ _
_ _ _ _ _ _
# # _ # _ _
# # # # _ #
# # # # _ #
# # # # _ #

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.2.tar.gz (4.1 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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: puzzlecreator-1.1.2.tar.gz
  • Upload date:
  • Size: 4.1 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.2.tar.gz
Algorithm Hash digest
SHA256 5ef8444ac2bfd0b187be117bac84f2579f1b7462b6b63b045252707ce9405ea6
MD5 048c97b08338cd48bce97d9d8083eac1
BLAKE2b-256 bb7b7ac2ade62d33e9a103e6a0fa4a2d995d0f8bb83b4a74e4ef35fe19438c43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puzzlecreator-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1b640dc316e4fdee1cf5f5b35e1b622529963d361d25d109bb7800426d4f88
MD5 4a688c835ab6a097f3cdfae4c3c13089
BLAKE2b-256 b7eff220c7aff9cdcc274cfe21229421ac202ac7518ed4b7dfdfbe4f5e6875f1

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