Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NYT 2022-05-01 crashes #44

Closed
gkuenning opened this issue May 1, 2022 · 4 comments
Closed

NYT 2022-05-01 crashes #44

gkuenning opened this issue May 1, 2022 · 4 comments

Comments

@gkuenning
Copy link

gkuenning commented May 1, 2022

The NYT puzzle for 2022-05-01 crashes xword-dl:

Traceback (most recent call last): File "/usr/bin/xword-dl", line 33, in <module> sys.exit(load_entry_point('xword-dl==2022.2.16', 'console_scripts', 'xword-dl')()) File "/usr/lib/python3.6/site-packages/xword_dl-2022.2.16-py3.6.egg/xword_dl.py", line 1096, in main File "/usr/lib/python3.6/site-packages/xword_dl-2022.2.16-py3.6.egg/xword_dl.py", line 63, in by_keyword File "/usr/lib/python3.6/site-packages/xword_dl-2022.2.16-py3.6.egg/xword_dl.py", line 265, in download File "/usr/lib/python3.6/site-packages/xword_dl-2022.2.16-py3.6.egg/xword_dl.py", line 962, in parse_xword IndexError: string index out of range

That line is solution += square[0][0], which happens after some other code that proves the puzzle isn't empty, and after some checks on the shape of the square. I can see that it would fail, for example, if square was multiple characters. So my guess is that the NYT has violated some standard (is there one?) or some assumption about puzzle formats.

@thisisparker
Copy link
Owner

Thanks for reporting! I was able to repro this and figure out the issues.

That third prong of the conditional set is for rebus answers, and the .puz file requires a single letter in the solution spot. The double slice thing (square[0][0]) grabs the first letter of the first acceptable rebus answer provided.

In this case, and this puzzle's tech was kind of a fiasco, the first acceptable option provided is an empty string. There isn't a public spec that these are built to, so they're not strictly in violation of anything by doing that, but it didn't work well with solvers (and the .puz format doesn't let you use an empty string in that slot anyway.)

The fix for this would be to check whether the first provided acceptable answer is an empty string and if so... provide an X instead of its first character? Or move onto the second string? (In this case, the second acceptable answer was the string NOTHING so this would somewhat confusingly jam N into the solution.)

I'm inclined to say that this is enough of an edge scenario that we shouldn't overfit to it with a special case. But if you have thoughts I'd be happy to hear them!

@gkuenning
Copy link
Author

gkuenning commented May 23, 2022 via email

@thisisparker
Copy link
Owner

The LAT issue should be fixed by the latest release, which you can upgrade through pip or this repo, whichever you've previously done. (The new version with the fix will be 2022.5.21.) In that case it's not a weird gimmick, but a change in how they're read into the online solver.

I'm closing this issue but feel free to open a new one or be in touch if you run into any problems!

@gkuenning
Copy link
Author

gkuenning commented May 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants