Seth-McKilla / ai-crossword

Crossword generator powered by OpenAI.
https://ai-crossword.vercel.app
2 stars 1 forks source link

Initial Crossword Generation Capability #2

Open CasimirCam opened 1 year ago

CasimirCam commented 1 year ago

closes #1

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
ai-crossword ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 23, 2023 at 1:34AM (UTC)
CasimirCam commented 1 year ago

General description of things to do (later, hehe):

  1. Add a smoother (less-dramatic) process to 'pass-over' words that don't fit in the puzzle & revisit them later (currently if this occurs, a break statement is encountered and generate_crossword() is called again.

  2. Build write-out method to place file in a deliberate, conspicuous location in the correct format, etc.

  3. Handle ingestion of answerBank and size - I'm not sure what the best way s, but a simple .ini file can be used with Python's configparser library.

Seth-McKilla commented 1 year ago

Relevant: https://gist.github.com/nitaku/10d0662536f37a087e1b

CasimirCam commented 1 year ago

Changed the input arguments to the main() script for clarity: gridLength and answerList with defaults for testing ability.

Added some basic input validation (acknowledging that some may be performed 'up top').

I'm not exactly sure how the addition of input arguments to main() is affected by the entry-point handling at the end of the main.py script (a common convention I've always used, but not entirely sure how it works):

if __name__ == '__main__':
    main()                    # <--- Does this line need the input arguments? Not sure.

A potentially useful excerpt regarding its usage:

"When a Python file is executed, the interpreter sets a special variable called name to "main" if the file is being run as the main program. If the file is being imported as a module into another program, the name variable will be set to the name of the module.

The if name == 'main': statement checks if the current file is being run as the main program by comparing the value of name to the string "main". If the comparison is true, the main() function is called.

This approach is commonly used to provide a module with both a library interface (when it is imported as a module) and a command-line interface (when it is executed directly). By separating these two interfaces, the module can be used in different ways, making it more flexible and reusable."

The output file is written to ./python/output/crossword_glossary.json