joshbduncan / word-search-generator

Make awesome Word Search puzzles!
MIT License
75 stars 24 forks source link

--no-validators results in error: unrecognized arguments: --no-validators #56

Closed tomnyc closed 11 months ago

tomnyc commented 11 months ago

I am using the CLI of word-search-generator (version 3.5).

word-search --no-validators house apartment -s 20 -l 3 -f JSON -o test.json

causes the following error:

error: unrecognized arguments: --no-validators

Any idea what I am doing wrong?

joshbduncan commented 11 months ago

Hmm, that exact command works just fine for me. Can you confirm you are on version 3.5.0? Just run the command below to make sure...

word-search --version

If you are on version 3.5.0, let me know as I'll need to look a bit deeper. Thanks!

tomnyc commented 11 months ago

Yes, a

word-search --version

returns

word-search 3.5.0

Interestingly the --no-validators flag is also not mentioned in the usage hint:

usage: word-search [-h] [-c] [-d DIFFICULTY] [-f EXPORT_FORMAT] [-im IMAGE_MASK | -m MASK_SHAPE] [-o OUTPUT] [-pm] [-r RANDOM] [-rx RANDOM_SECRET_WORDS] [-s SIZE] [-x SECRET_WORDS] [-xd SECRET_DIFFICULTY] [--version] [words ...]

word-search -h also doesn't mention this flag. It is as if I am using an old version but then again the version shown to me is 3.5.0.

Thanks by the way for this awesome generator.

joshbduncan commented 11 months ago

Sorry, I just realized that feature hasn't been released yet. It is here on GitHub but the latest PyPi version 3.5.0 (which you have) doesn't include the --no-validators functionality. You can read about it here in the changelog.

You can actually install it right from GitHub using the pip command below if you want to disable the validation.

$ pip install git+https://github.com/joshbduncan/word-search-generator

Please note, that you'll need to uninstall the old version first (pip uninstall word-search-generator) as there are some conflicting dependency versions.

Sorry for the confusion. The validator code is good to go, I just need to add some testing for the new [play] tui functionality before I release to PyPi.

Let me know if you have any other issues or questions... And I'm glad to hear you found use for the generator. Cheers!

tomnyc commented 10 months ago

That worked. Now I have version 3.5.0 and --no-validators available.

One question though (and I know this is not good practice):

word-search --no-validators house household -s 20 -l 3 -f JSON -o test.json

returns a JSON file with only "household" in it.

Shouldn't it return a JSON file with "house" and "household" in it since the validators are disabled?

joshbduncan commented 10 months ago

So, you actually uncovered a small bug. If you run the command below a few times, you would notice sometimes both words are placed and other times only one word is placed.

$ word-search --no-validators house household -s 20 -l 3 -f JSON -o test.json

I'll try and keep the explanation short (as you probably don't care) but, while placing words (and filler characters) in the puzzle, the generator checks to make sure a duplicate word isn't created by random.

In the example below, if you tried to place the word "fat" at row=3, col=2 (0-indexed) going east, you would create a duplicate word of "bat". There was a small bug that was creating random false positives for duplicated words and that is why both of your words would be placed sometimes and not others.

B * * * R
* A * * A
* * T * T
* * * * *
* * C A B

And since previous versions didn't allow specifying custom validators or no validators at all, there were never any sub words (words within other words like 'house' and 'household') that would cause this bug to actually effect anything.

Anyway, I just pushed a new version to Github with a fix for this bug. So, just reinstall using that same pip command from above and all should work now. Let me know if you still have issues? Cheers!

tomnyc commented 10 months ago

Thanks for the explanation!

Usually I check the words beforehand and try to avoid sub words.