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

Answers don't recreate crossword #8

Open
karlic opened this issue Feb 20, 2020 · 4 comments
Open

Answers don't recreate crossword #8

karlic opened this issue Feb 20, 2020 · 4 comments

Comments

@karlic
Copy link

karlic commented Feb 20, 2020

I want to recreate a crossword grid using only the answers. As a test I am using answers from a known grid (15x15 blocked crossword).
I input the answers, but the created grid does not match the known grid and is too big.
I have set:
var rows = 15; and
var table = generateTable(blankTable, rows, cols, words, [0, 0, 0, 0]);
in
function generateSimpleTable(words)
which makes a better match, but not identical.

What else do I need to change to make this work?

Thank you.

@MichaelWehar
Copy link
Owner

MichaelWehar commented Feb 28, 2020

Thank you very much for submitting this issue! I really appreciate it and I am sorry for the delay.

Here are some of my initial thoughts:

(1) If you're able to share more information, that would be greatly appreciated. For example, if you can share the 15 by 15 crossword that you are trying to generate, that would help quite a bit.

(2) I hadn't thought about it before, but being able to regenerate an existing "pretty" or "nice" crossword layout could be a great performance test going along with Issue #2. What is your motivation for regenerating existing crossword layouts?

(3) Regenerating an existing crossword layout might not be computationally feasible. There could be exponentially many arrangements that would need to be considered. Maybe instead, the challenge should be to generate a similar crossword layout using at least a specified number of words while restricted to specified dimensions.

(4) The crossword layout generator is currently at a state that is adequate for generating simple crossword layouts like you would see in middle school worksheets or mobile games like wordscapes. The layout generator is not yet optimized to generate extremely dense layouts like are seen in famous newspapers. Generating such layouts appears challenging for small word banks. Existing products that we've experimented with generate such layouts only with very large words banks where there is much more flexibility on what words can be used.

I'm still learning so if I said anything wrong or that you disagree with, there is a good chance that I made some mistakes and I would be thrilled to learn more from your experiences with crosswords.

I am very happy to have you here and welcome any of your contributions to the project. :)

@MichaelWehar
Copy link
Owner

MichaelWehar commented Feb 28, 2020

I noticed that you are calling:

generateTable(blankTable, rows, cols, words, [0, 0, 0, 0]);

The list [0, 0, 0, 0] is used to specify weights (between 0 and 1) for four different features. Assigning a higher weight to a feature will incentivize the layout generator to create a layout that satisfies a certain property such as having less blank squares or having more connections between words.

The generator doesn't check every possible arrangement because that would be too time consuming. As a result, we experimentally added incentives in an attempt to improve the results. We haven't yet proven that these incentives are beneficial and that is why I added Issue #2 which discusses our need to develop performance metrics.

@karlic
Copy link
Author

karlic commented Mar 1, 2020

Thanks for the reply.

(1) The example crossword is attached below in AcrossLite txt format (but you can see the layout
in the section).
(2) Yeah, I kind of assumed your code would find the 'correct' grid given ideal conditions :-)
I have some old crosswords which have the grid as a code, but no longer have the code-grid
lookup.
(3) I guess that the exact layout isn't that important. BUT since all the answers CAN be placed,
then they should be.
(4) I thought it might be hard work, that's why I'd hoped your code would save me the effort. ;-)
(5) I noticed the four weights (features), but [0, 0, 0, 0] seemed to provide the best (but not
perfect) fit.
(6) Perhaps a fifth feature could be 'keep going until all the words are placed', which would be
useful in my use case.

I did make a start on writing my own code, but got side tracked. I'll have another go at it and report back if there is anything I can add.

Here is the JSON I used:
var input_json = [
{"answer":"LEADERSHIP","orientation":"across"},
{"answer":"FILL","orientation":"across"},
{"answer":"TREACLY","orientation":"across"},
{"answer":"RARITY","orientation":"across"},
{"answer":"EMERGE","orientation":"across"},
{"answer":"APPLAUSE","orientation":"across"},
{"answer":"CONTEST","orientation":"across"},
{"answer":"STROBES","orientation":"across"},
{"answer":"RETRACT","orientation":"across"},
{"answer":"ASHTRAY","orientation":"across"},
{"answer":"FALSETTO","orientation":"across"},
{"answer":"RUSTLE","orientation":"across"},
{"answer":"UPROAR","orientation":"across"},
{"answer":"AILMENT","orientation":"across"},
{"answer":"LAND","orientation":"across"},
{"answer":"EASYSTREET","orientation":"across"},
{"answer":"EXTEMPORE","orientation":"down"},
{"answer":"DREAR","orientation":"down"},
{"answer":"RICKETS","orientation":"down"},
{"answer":"HEYDAY","orientation":"down"},
{"answer":"PARAPET","orientation":"down"},
{"answer":"FARTABOUT","orientation":"down"},
{"answer":"LOTUS","orientation":"down"},
{"answer":"THRESHOLD","orientation":"down"},
{"answer":"EPAULETTE","orientation":"down"},
{"answer":"COTERIE","orientation":"down"},
{"answer":"SURPLUS","orientation":"down"},
{"answer":"CHILLAX","orientation":"down"},
{"answer":"MORASS","orientation":"down"},
{"answer":"ALPHA","orientation":"down"},
{"answer":"SMEAR","orientation":"down"}
]

671.txt

@MichaelWehar
Copy link
Owner

Thank you very much for clarifying and I'm sorry about the long delay!

(2) What does it mean "grid as a code", but not "code-grid lookup"?

More generally, I'm still trying to understand.

Questions:

  • There was a crossword grid, but all you have now are the answers?
  • Do you know if those answers are acrosses or downs?
  • Do you know their position numbers?
  • Do you know the dimensions of the grid? (I think you said 15 by 15.)

Thanks again and I hope that you are doing well!

P.S. We made a lot of progress on automatically filling in grids. We hope to release that as a separate open source project in the future. :)

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